home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / qbware.arc / QBWARE.DOC next >
Encoding:
Text File  |  1988-04-02  |  145.9 KB  |  8,185 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.                                    Q B W A R E / 1
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.                           THE QUICKBASIC INTERFACE LIBRARIES
  24.  
  25.  
  26.  
  27.                                      Version 1.10
  28.  
  29.  
  30.  
  31.  
  32.  
  33.                            R E F E R E N C E    M A N U A L
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.                                      AJM Software
  46.                                     P.O. Box 5303
  47.                                 Arvada, Co. 80005-0303
  48.  
  49.  
  50.  
  51.  
  52.  
  53.                            Copyright (c) 1987 AJM Software
  54.                                  All Rights Reserved
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.                                   TABLE OF CONTENTS
  74.  
  75.  
  76.       I.     Introduction to QBWARE/1 ............................    2
  77.  
  78.       II.    A word about User supported software ................    3
  79.  
  80.       III.   Warranty Information ................................    5
  81.  
  82.       IV.    Registration and License Information ................    6
  83.  
  84.       V.     Product Support .....................................   10
  85.  
  86.       VI.    Using QBWARE/1 ......................................   11
  87.  
  88.       VII.   PRECAUTIONS (READ THIS SECTION) .....................   14
  89.  
  90.       VIII.  BIOS Video Services .................................   15
  91.  
  92.       IX     BIOS Keyboard Services ..............................   25
  93.  
  94.       X.     BIOS Diskette Services ..............................   32
  95.  
  96.       XI.    BIOS Miscellaneous Services .........................   39
  97.  
  98.       XII.   BIOS AT Disk Services ...............................   46
  99.  
  100.       XIII.  File Attribute Services .............................   56
  101.  
  102.       XIV.   File Access Services ................................   64
  103.  
  104.       XV.    DOS Replacement Services ............................   74
  105.  
  106.       XVI.   Miscellaneous DOS services ..........................   87
  107.  
  108.       XVII.  The Print Spooler ...................................   97
  109.  
  110.       XVIII. DOS Memory Management ...............................  103
  111.  
  112.       Appendices .................................................  108
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.                        Copyright (c) 1987, AJM Software 
  128.                                     -Page 1-
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.                               Introduction to QBWARE/1
  141.  
  142.  
  143.       QBWARE/1 is a comprehensive set of callable routines that provide easy to
  144.       use extensions to QuickBasic.  The DOS subroutines are specifically
  145.       designed to provide an easy to use interface between Quickbasic programs
  146.       and certain DOS facilities that would normally be unavailable to a Quick-
  147.       basic program.  These include access to the DOS print spooler and memory
  148.       management routines.  It is very important to read the manual before using
  149.       any of these services, as proper setup is important.
  150.  
  151.       The BIOS subroutines are specifically designed to provide an easy to use
  152.       interface between Quickbasic programs and your computer's Basic
  153.       Input/Output System (BIOS).  The system BIOS is a collection of programs
  154.       that control most of the fundamental processes or functions of your com-
  155.       puter such as system startup or initialization, communications with per-
  156.       ipheral devices such as video, disks, modems, printers, etc., handling of
  157.       certain error conditions such as Ctrl-Break, Divide by  zero, and others.
  158.       Some of the services presented here are already provided in Quickbasic and
  159.       many of them are not.  They will provide you with a greater degree of con-
  160.       trol over the environment in which your program executes as well as per-
  161.       forming these services much more quickly.
  162.  
  163.       The file management subroutines are specifically designed to provide an
  164.       easy to use interface between Quickbasic programs and the DOS File Manage-
  165.       ment services.  DOS File Management services are a layer of software that
  166.       sit between your program and the computer's diskette or hard drive.
  167.  
  168.       You must keep in mind that many of these routines interact with your com-
  169.       puter's BIOS and have been designed and tested on IBM and COMPAQ comput-
  170.       ers.  In order for them to function properly, your computer must be an IBM
  171.       or Compatible.  These functions have been tested with version 2, 2.01, 3
  172.       and version 4 of Quickbasic.
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.       Quickbasic is a registered trademark of Microsoft.
  191.  
  192.  
  193.                        Copyright (c) 1987, AJM Software 
  194.                                     -Page 2-
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.                          A Word about User-supported Software
  208.  
  209.     User-supported software is a means for the computing community to receive
  210.     quality software while directly supporting software authors.  It is based
  211.     on the ideas that:
  212.  
  213.           The value and utility of software is best assessed by the
  214.           user on his or her own system.  Only after using a program
  215.           can one really determine whether it serves personal
  216.           applications, needs and tastes.
  217.  
  218.           The creation of independent personal computer software can
  219.           and should be supported by the computing community.
  220.  
  221.           Copying of programs should be encouraged, rather than
  222.           restricted.  The ease with which software can be distributed
  223.           outside traditional commercial channels reflects the
  224.           strength, rather than the weakness, of electronic
  225.           information.
  226.  
  227.     Under the user supported concept, anyone may request a copy of a
  228.     user-supported program by sending a blank, formatted disk to the program
  229.     author together with an addressed, postage-paid return mailer.  A copy of
  230.     the program, along with documentation on disk, will be sent by return
  231.     mail on the user's disk.
  232.  
  233.     The program carries a notice suggesting registration for the program. You
  234.     should register if you are going to use the program on a regular basis.
  235.     Regardless of whether you register and use the program, you are
  236.     encouraged to copy and distribute the program for the private,
  237.     non-commercial, trial use of others.
  238.  
  239.     User supported software is generally not public domain material; most
  240.     programs of this nature carry a copyright notice.  Rather, the author has
  241.     licensed you to copy and use the program under certain conditions.
  242.     Likewise, user supported software is not intended to be free software; it
  243.     is an experiment in economics, not altruism.  It is intended to provide
  244.     quality software at a low price, while directly supporting the author,
  245.     without the overhead of distributors, dealers and advertising that
  246.     produces $500 software packages.
  247.  
  248.     User supported software is having a hard time.  More and more packages
  249.     are being taken out of this market, and offered as more traditional, and
  250.     expensive, products.  The reason for this is simple: lots of people are
  251.     using the packages but very few are paying for them.  And without the
  252.     support of the users, there is absolutely no incentive for software
  253.     authors to provide their programs in this fashion.
  254.  
  255.  
  256.  
  257.  
  258.  
  259.                        Copyright (c) 1987, AJM Software 
  260.                                     -Page 3-
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.     There are many good reasons to register.  Besides supporting the author
  275.     (that is, paying for the software you use), you generally get better
  276.     support and receive mailed notification of updates and other products.
  277.  
  278.     In conclusion, if you regularly use a user supported program (sometimes
  279.     called Freeware or Shareware) and have not sent in a registration to the
  280.     author, please do so now.  Only through the financial support of users
  281.     will this kind of inexpensive software continue to be available.
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.                        Copyright (c) 1987, AJM Software 
  326.                                     -Page 4-
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.                                     WARRANTY
  340.  
  341.  
  342.     AJM Software makes no warranty of any kind, express or implied,
  343.     including without limitation, any warranties of merchantability
  344.     and/or fitness for a particular purpose.  AJM Software shall
  345.     not be liable for any damages, whether direct, indirect, special or
  346.     consequential arising from a failure of this program to operate in the
  347.     manner desired by the user.  AJM Software shall not be liable
  348.     for any damage to data or property which may be caused directly or
  349.     indirectly by use of the program.
  350.  
  351.     IN NO EVENT WILL AJM Software BE LIABLE TO YOU FOR ANY DAMAGES,
  352.     INCLUDING ANY LOST PROFITS, LOST SAVINGS OR OTHER INCIDENTAL OR
  353.     CONSEQUENTIAL DAMAGES ARISING OUT OF YOUR USE OR INABILITY TO USE
  354.     THE PROGRAM, OR FOR ANY CLAIM BY ANY OTHER PARTY.
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.                        Copyright (c) 1987, AJM Software 
  392.                                     -Page 5-
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.                         Registration and ordering information
  406.  
  407.  
  408.     A QBWARE/1 registration licenses you to use the product on a regular
  409.     basis.  Registration includes mailed notification of updates and priority
  410.     support.
  411.     Users need register only one version of QBWARE/1 - registration includes
  412.     licensed use of all upgrades.
  413.  
  414.     Individual registrations for QBWARE/1 are available from AJM Software
  415.     at a cost of $39.00.  AJM will provide you with the most current release
  416.     of QBWARE/1 in both object and assembly source code form on 5 1/4 inch
  417.     diskette or 3 1/2" diskette.  The reference manual will also be included
  418.     on the diskette.
  419.  
  420.     Registration entitles you to include any QBWARE/1 routine in your
  421.     applications for distribution without royalty.  Including QBWARE/1
  422.     in your applications without registration is strictly prohibited.
  423.  
  424.     Quantity discounts are available.  Please see the section titled
  425.     'Corporate and quantity purchases'.
  426.  
  427.     In addition, evaluation disks are available at any time for $10.  These
  428.     disks do not include registration.  The fee covers diskette, postage and
  429.     handling.
  430.  
  431.     Please use the enclosed order form when placing an order.
  432.  
  433.     ORDERS OUTSIDE THE US: Please include an additional $10.00 to cover
  434.     additional postage and handling costs.  No C.O.D.'s will be accepted
  435.     on orders delivered outside the US.
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.                        Copyright (c) 1987, AJM Software 
  458.                                     -Page 6-
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.     Remit to:                     AJM Software                     Order Form
  472.                                   P.O. Box 5303
  473.                               Arvada, CO 80005-0303
  474.  
  475.     Please send:
  476.  
  477.     ____ QBWARE/1 Disk (Evaluation only) ........... @ $ 10.00 ea  $ ______
  478.          (includes all routines in .QLB form and manual on disk)
  479.  
  480.     ____ QBWARE/1 Registration ..................... @ $ 39.00 ea  $ ______
  481.          (includes QBWARE/1 disk and source code)
  482.                                                          Subtotal    ______
  483.  
  484.       Please check appropriate version              Less Discount   <______>
  485.  
  486.       QB V2     ____                           C.O.D. Fee ($5.00)    ______
  487.  
  488.       QB V3     ____                          3 1/2" Disk ($5.00)    ______
  489.  
  490.       QB V4     ____                                         Total $ ______
  491.  
  492.     Payment by:   ( ) Check   ( ) C.O.D.
  493.  
  494.        Name: ____________________________________________________________
  495.  
  496.     Company: ____________________________________________________________
  497.  
  498.     Address: ____________________________________________________________
  499.  
  500.            : ____________________________________________________________
  501.  
  502.            : ____________________________________________________________
  503.  
  504.     Day Phone: _________________________ Eve: ___________________________
  505.  
  506.  
  507.  
  508.     ORDERS OUTSIDE THE US: Please include an additional $10.00 to cover
  509.     additional postage and handling costs.  No C.O.D.'s will be accepted
  510.     on orders delivered outside the US.
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.                        Copyright (c) 1987, AJM Software 
  524.                                     -Page 7-
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.                         Corporate and Quantity Purchases
  539.  
  540.  
  541.     All corporate, business, government or other commercial users of QBWARE/1
  542.     must be registered.  We offer quantity discounts starting at the sixth
  543.     copy.
  544.  
  545.     Orders in quantities of less than 50 units are handled as bulk purchases.
  546.     Purchases of over 50 units may be handled as quantity purchases or as
  547.     corporate licensing agreements.  Licensing agreements allow duplication
  548.     and distribution of specific numbers of copies within the licensed
  549.     institution.  Duplication of multiple copies is not allowed except
  550.     through execution of a licensing agreement.  Please write for
  551.     details.
  552.  
  553.     The quantity purchase discounts are as follows:
  554.  
  555.             0- 5  copies:      no discount
  556.             6- 20 copies:     20% discount
  557.            21+    copies:     40% discount
  558.  
  559.     ALL PRICES AND DISCOUNTS ARE SUBJECT TO CHANGE WITHOUT NOTICE.  Discounts
  560.     are not cumulative; they apply to single orders of like products only.
  561.     Unit prices are the same as for individual users.
  562.  
  563.     WARNING: YOU MAY NOT USE QBWARE/1 WITHIN YOUR ORGANIZATION WITHOUT A PRIOR
  564.     PURCHASE OR LICENSE ARRANGEMENT.
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.                        Copyright (c) 1987, AJM Software 
  590.                                     -Page 8-
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.                                      LICENSE
  604.  
  605.     All versions of QBWARE/1, including version 1.0, are not public domain
  606.     software, nor are they free software.
  607.  
  608.     QBWARE/1 is copyright (C) 1987 by AJM Software
  609.  
  610.     Non-registered users are granted a limited license to use QBWARE/1 on a
  611.     trial basis for the purpose of determining whether it is suitable
  612.     for their needs.  Use of QBWARE/1, except for this limited purpose,
  613.     requires registration.  Use of non-registered copies of QBWARE/1 by any
  614.     person, business, corporation, governmental agency or other entity
  615.     institution is strictly forbidden.
  616.  
  617.     Registration permits a user the license to use QBWARE/1 for development
  618.     purposes, only on a single computer.  QBWARE/1 can be included into any
  619.     program and distributed in library form only without royalty.
  620.     A registered user may use the program on a different computer,
  621.     but may not use the program on more than one computer at the same time.
  622.  
  623.     All users are granted a limited license to copy QBWARE/1 only for the
  624.     trial use of others subject to the above limitations, and also the
  625.     following:
  626.  
  627.           QBWARE/1 must be copied in unmodified form, complete with the file
  628.           containing this license information.
  629.  
  630.           The full QBWARE/1 documentation must be included with the copy.
  631.  
  632.           No fee, charge or other compensation may be accepted or requested
  633.           by any licensee, except a handling fee not to exceed $10.00
  634.  
  635.           QBWARE/1 may not be distributed in conjunction with any other
  636.           product.
  637.  
  638.           The ASSEMBLY source code for QBWARE/1 may NOT be distributed under
  639.           any circumstances.
  640.  
  641.           The object modules supplied with a registered copy of QBWARE/1
  642.           may NOT be distributed under any circumstances.
  643.  
  644.     Operators of electronic bulletin board systems (Sysops) may post QBWARE/1
  645.     for downloading by their users only as long as the above conditions are
  646.     met.
  647.  
  648.     Distributors of public domain or user supported software, other than
  649.     operators of electronic bulletin board systems, may distribute
  650.     copies of QBWARE/1 subject to the above conditions only after obtaining
  651.     written permission from AJM Software.
  652.  
  653.  
  654.  
  655.                        Copyright (c) 1987, AJM Software 
  656.                                     -Page 9-
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.                                    Product Support
  670.  
  671.     If you have any questions or comments about the use of QBWARE/1, please
  672.     fill out a problem log and send it to us.
  673.  
  674.     In your note, describe as completely as possible the problem you
  675.     are having.  Let us know your machine configuration, which routine
  676.     you are questioning, the version of QBWARE/1, and any resident software
  677.     installed.  If possible, include a copy (on paper) of your source code.
  678.  
  679.     Describe what steps you take before the problem occurs, and exactly what
  680.     the program does when it occurs.  If you do not provide us with a
  681.     complete description of the problem there is little we can do to help.
  682.     We'll do our best to get you past the problem, but if you are not a
  683.     registered user we do not guarantee to provide support of any kind.
  684.  
  685.     Please be patient.  We usually respond to registered users within 3
  686.     working days at the most.
  687.  
  688.     We will provide support to non-registered users at our discretion.  It
  689.     generally depends on how the request is worded and the mental disposition
  690.     of the staff person assigned to handle requests on that day.
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.                        Copyright (c) 1987, AJM Software 
  722.                                    -Page 10-
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.                                     Using QBWARE/1
  735.                            QuickBasic versions 2, 2.01, 3
  736.  
  737.       All of the QBWARE/1 routines can be accessed via the Quickbasic 'Call'
  738.       statement.  The format of this statement is as follows:
  739.  
  740.          Call Function(Parm1%, Parm2%, Parm3$)
  741.  
  742.       Function is the name of the routine to be executed.  It must be spelled
  743.       exactly as shown in the following chapters.  The parameters to be passed
  744.       to the routine will also be explained in the following chapters.  You must
  745.       use the exact number of parameters shown in each function description and
  746.       each parameter must be the type (i.e. character or integer) shown in each
  747.       function description.  Using an incorrect number of parameters or using a
  748.       parameter of the wrong type (i.e. using character instead of integer) will
  749.       generally result in the abnormal termination of your program.  Usually you
  750.       will get either a 'String Space Corrupt' error or you will start executing
  751.       the wrong statements in your program.  In any event, it is almost impos-
  752.       sible to predict the results of these two types of errors, so it is criti-
  753.       cal that you be very careful in coding the call statements.
  754.  
  755.       The parameters passed to QBWARE/1 routines will be either character or
  756.       numeric integers.  There are no special requirements for passing integers
  757.       and constants may also be used.  There is no functional difference between
  758.       these two sets of statements:
  759.  
  760.          Example 1
  761.  
  762.               Drive$ = "A"                      'Indicate drive a
  763.               Vol$ = "DISK LABEL "              'New volume label
  764.               Call FlPVol(Drive$, Vol$, Rc%)    'Call QBWARE/1 routine
  765.  
  766.          Example 2
  767.  
  768.               Call FlPVol("A", "DISK LABEL ", Rc%)
  769.  
  770.       Note that Rc% must not be defined as a constant because the QBWARE routine
  771.       will return a value in this field and your Quickbasic program cannot
  772.       access this field if it is defined as a constant.  All character fields
  773.       must be initialized to the proper length before calling a QBWARE/1 func-
  774.       tion.  Failing to do so may result in a 'String Space Corrupt' condition.
  775.       The following two examples appear similar but Example 1 will fail and
  776.       Example 2 will succeed because 'Char$' has been properly initialized.
  777.  
  778.          Example 1 (incorrect)
  779.  
  780.               Char$ = ""                        'clear work field
  781.               Call FlGDrv(Char$)                'get the current drive
  782.  
  783.  
  784.  
  785.  
  786.  
  787.                        Copyright (c) 1987, AJM Software 
  788.                                    -Page 11-
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.          Example 2 (correct)
  803.  
  804.               Char$ = space$(1)                 'clear work field
  805.               Call FlGDrv(Char$,)               'get the current drive
  806.  
  807.  
  808.       Including the QBWARE/1 routines in your programs can be accomplished in
  809.       a variety of ways.  The non-registered user can do one of the following:
  810.  
  811.        1)  compile the program from within the Quickbasic interactive develop-
  812.            ment environment
  813.  
  814.        2)  compile the program from the DOS prompt
  815.  
  816.       In order to use method 1, place the file QBWARE.EXE in the directory con-
  817.       taining your Quickbasic files (i.e. QB.EXE and BRUN20.LIB).  When starting
  818.       Quickbasic, enter the following command at the DOS prompt:
  819.  
  820.          QB /L QBWARE.EXE
  821.  
  822.       You may now use any of the QBWARE.LIB functions in your programs.  If you
  823.       compile your program using the 'Exe' output option, the appropriate
  824.       QBWARE.LIB functions will be available to the EXE file.
  825.  
  826.       In order to use method 2, place the file QBWARE.EXE in the directory con-
  827.       taining your Quickbasic system files.  The following example shows how to
  828.       create an executable file from the Basic source code in the file
  829.       'FILECHK.BAS':
  830.  
  831.          QB FILECHK /L QBWARE.EXE;
  832.          LINK FILECHK;
  833.  
  834.       Doing this will create the executable file 'FILECHK.EXE'
  835.  
  836.       Additionally, registered users will have the ability to create their own
  837.       custom user library (see the file BUILDLIB.SCR on the QBWARE.LIB disk for
  838.       instructions) or they can include the appropriate functions into their
  839.       program when it is linked.  For example, if the program 'TEST.BAS' uses
  840.       the QBWARE/1 routines DOSVER and BOOT, an executable file can be
  841.       created using the following commands at the DOS prompt:
  842.  
  843.          QB TEST;
  844.          LINK TEST DOSVER BOOT;
  845.  
  846.       This assumes that all of the files on the QBWARE.LIB disk have been placed
  847.       into the directory containing the Quickbasic system files.
  848.  
  849.  
  850.  
  851.  
  852.  
  853.                        Copyright (c) 1987, AJM Software 
  854.                                    -Page 12-
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.                                     Using QBWARE/1
  867.                                  QuickBasic version 4
  868.  
  869.  
  870.       Parameter passing is pretty much the same under QB4 with a single excep-
  871.       tion.  Arrays are handled a little differently.  When passing entire
  872.       arrays to the QBWARE/1 routine, use VARPTR.
  873.  
  874.  
  875.       QB2       Call FlFind(Count%, DirList$(LBound(DirList$)))
  876.  
  877.       QB4       Call FlFind(Count%, VARPTR(DirList$(LBound(DirList$))))
  878.  
  879.  
  880.       Using VARPTR will insure compatibility in compiling from within the QB4
  881.       environment and from the DOS prompt.
  882.  
  883.       When starting QuickBasic V4 enter the following:
  884.  
  885.          QB /L QBWARE
  886.  
  887.       This automatically loads the QBWARE/1 quick library into the QB$ environ-
  888.       ment.
  889.  
  890.       To compile from the DOS prompt, do the following:
  891.  
  892.          BC PROGNAM;
  893.          LINK /EX /NOE PROGNAM,,,BRUN40 QBWARE;
  894.  
  895.       or
  896.  
  897.          BC PROGNAM /O;
  898.          LINK /EX /NOE PROGNAM,,,BCOM40 QBWARE
  899.  
  900.       IN ORDER TO ACHIEVE CONSISTENT RESULTS, ALWAYS CREATE YOUR EXE FILES AS
  901.       DESCRIBED ABOVE.  IN QB4, YOU CANNOT CREATE AN EXE FILE USING THE QBWARE/1
  902.       ROUTINES FROM THE QB ENVIRONMENT.  YOU MUST DO THIS FROM THE DOS PROMPT.
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.                        Copyright (c) 1987, AJM Software 
  920.                                    -Page 13-
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.                                   PRECAUTIONS!!!!!!
  934.  
  935.  
  936.       These routines were designed to used with Quickbasic on an IBM  PC or com-
  937.       patible computer.  Using this product with any Basic compiler or inter-
  938.       preter other than Quickbasic version 2 or 3 will probably not work and may
  939.       cause loss of data.
  940.  
  941.       Using this product on a non-IBM compatible computer will give hit or miss
  942.       results.  Some things will work, some things won't work.  The only way to
  943.       find out is to try.
  944.  
  945.       A SPECIAL NOTE ABOUT HARD DISKS - there are many manufacturers and vari-
  946.       eties of hard disks available for the IBM PC and compatible computer.
  947.       Many of these hard disks work through the traditional BIOS functions and
  948.       many provide their own proprietary software to function properly.  These
  949.       disks with proprietary software may not respond properly to some of the
  950.       BIOS interface routines.  IN ANY EVENT, DO NOT TEST ANY HARD DISK OR
  951.       FLOPPY DISK ROUTINES WITHOUT FIRST BACKING UP YOUR DISK - REPEAT - DO
  952.       NOT TEST ANY HARD DISK OR FLOPPY DISK ROUTINES WITHOUT FIRST BACKING UP
  953.       YOUR DISK.
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.                        Copyright (c) 1987, AJM Software 
  986.                                    -Page 14-
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.                                The BIOS Video Services
  1000.  
  1001.  
  1002.       Function Summary
  1003.  
  1004.  
  1005.       BSVMODE  - Get or set video mode
  1006.  
  1007.       BSVSCUR  - Set or get cursor size
  1008.  
  1009.       BSVSWID  - Get screen width
  1010.  
  1011.       BSVSPOS  - Get or set cursor position
  1012.  
  1013.       BSVSPAG  - Get or set video display page
  1014.  
  1015.       BSVSCRUP - Scroll up or clear a window
  1016.  
  1017.       BSVSCRDN - Scroll down or clear a window
  1018.  
  1019.       BSVRCHR  - Read a character and attribute from the screen
  1020.  
  1021.       BSVWCHR  - Write a character to the screen
  1022.  
  1023.       BSVWTTY  - Write in teletype mode
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.                        Copyright (c) 1987, AJM Software 
  1052.                                    -Page 15-
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.       BSVMODE  - Get or set video mode 
  1066.  
  1067.       Usage - Call BsVMode(Function%, Mode%)
  1068.  
  1069.  
  1070.          Function%    0 - set video mode
  1071.                       1 - get video mode
  1072.  
  1073.          Mode%   (When Function% = 0, Mode% must be initialized to one
  1074.                   of the following values.  When Function% = 1, Mode% will
  1075.                   return one of the following values.)
  1076.  
  1077.               Mode  Type                                   Adapter
  1078.  
  1079.               0     40 X 25 B/W text                       CGA
  1080.               1     40 X 25 16 color text                  CGA
  1081.               2     80 X 25 B/W text                       CGA
  1082.               3     80 X 25 16 color text                  CGA
  1083.               4     320 X 200 4 color graphics             CGA
  1084.               5     320 X 200 4-Grey graphics              CGA
  1085.               6     640 X 200 B/W graphics                 CGA
  1086.               7     80 X 25 B/W text                       MA(Monochrome)
  1087.               8     160 X 200 16 color graphics            PCjr
  1088.               9     320 X 200 16 color graphics            PCjr
  1089.               10    640 X 200 4 color graphics             PCjr
  1090.               10    640 X 200 16 color graphics            EGA
  1091.               13    320 X 200 4 color graphics             EGA
  1092.               14    640 X 200 16 color graphics            EGA
  1093.               15    640 X 350 4 color graphics             EGA
  1094.               16    640 X 350 4 or 16 color graphics       EGA
  1095.  
  1096.       Programming notes:
  1097.  
  1098.       For RGB monitors, there is no functional difference between modes 0 and 1,
  1099.       or between modes 2 and 3.
  1100.  
  1101.       The EGA will support all modes except 8 and 9.
  1102.  
  1103.       Normally, the screen buffer will be cleared when you set the video mode -
  1104.       even if you set it the same mode.  This is not, however, a recommended
  1105.       method for clearing the screen as it could cause some delay in many PC-
  1106.       compatibles.
  1107.  
  1108.       Using a mode that is not supported by your video adapter card will have
  1109.       unpredictable results.
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.                        Copyright (c) 1987, AJM Software 
  1118.                                    -Page 16-
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.       BSVSCUR  - Set or get cursor size
  1132.  
  1133.       Usage - Call BsVSCur(Function%, Start%, End%)
  1134.  
  1135.          Function%    0 - set cursor size
  1136.                       1 - get cursor size
  1137.  
  1138.          Start%       Starting scan line
  1139.  
  1140.          End%         Ending scan line
  1141.  
  1142.       Programming notes:
  1143.  
  1144.       The scan line is a row of pixels that make up a character on the screen.
  1145.       On monochrome monitors, there are 13 scan lines numbered 0 thru 12.  On
  1146.       RGB monitors, there are 8 scan lines numbered 0 thru 7.  The default val-
  1147.       ues for cursor size are as follows:
  1148.  
  1149.       Mode    Display                     Start       End
  1150.  
  1151.       0-3     RGB Monitor (text modes)      6          7
  1152.       7       Monochrome                    11         12
  1153.  
  1154.       The hardware causes the cursor to blink and it normally cannot be dis-
  1155.       abled while in text mode, however, some machines will cause the cursor to
  1156.       disappear when a starting scan line of 32 is used.  A technique that
  1157.       always makes the cursor disappear is to move it off the screen using
  1158.       BSVSPOS (e.g. move it to column 1, row 26).
  1159.  
  1160.       Using a starting scan line that is greater than the ending scan line will
  1161.       make the cursor wrap and cause a two-part cursor to show on the screen.
  1162.  
  1163.       Function% must be initialized prior to calling BSVSCUR.  If function% is 0
  1164.       then Start% and End% must be initialized to proper values prior to making
  1165.       the call.
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.                        Copyright (c) 1987, AJM Software 
  1184.                                    -Page 17-
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.       BSVSWID  - Get screen width
  1198.  
  1199.       Usage - Call BsVSWid(Wid%)
  1200.  
  1201.          Wid%         Number of characters that can be displayed on the screen -
  1202.                       either 40 or 80.
  1203.  
  1204.  
  1205.  
  1206.       BSVSPOS  - Get or set cursor position
  1207.  
  1208.       Usage - Call BsVSPos(Function%, Row%, Column%, Page%)
  1209.  
  1210.          Function%    0 - set cursor position
  1211.                       1 - get cursor position
  1212.  
  1213.          Row%         Cursor coordinate
  1214.  
  1215.          Column%      Cursor coordinate
  1216.  
  1217.          Page%        Display page whose cursor position is to be set or
  1218.                       retrieved.
  1219.  
  1220.  
  1221.       Programming notes:
  1222.  
  1223.       A separate cursor is maintained for each display page (See BSVSPAG for
  1224.       more on display pages).  The cursor is affected only in the display page
  1225.       specified.
  1226.  
  1227.       Coordinates (1,1) represent the upper left hand corner of the screen.
  1228.  
  1229.       Coordinates (80,25) represent the lower right-hand corner of the screen.
  1230.  
  1231.       Positioning the cursor outside the limits of the current display will
  1232.       cause the cursor to disappear.
  1233.  
  1234.       In graphics modes, Row% and Column% should be interpreted as pixel coordi-
  1235.       nates.
  1236.  
  1237.       Function% and Page% must be initialized prior to calling BSVSPOS.  If
  1238.       Function% is 0 then Row% and Column% must be initialized prior to making
  1239.       the call.
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.                        Copyright (c) 1987, AJM Software 
  1250.                                    -Page 18-
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.       BSVSPAG  - Get or set video display page
  1264.  
  1265.       Usage - Call(BsVSPag(Function%, Page%)
  1266.  
  1267.          Function%    0 - set current page
  1268.                       1 - get current page
  1269.  
  1270.       Programming Notes:
  1271.  
  1272.       Valid page ranges are as follows:
  1273.  
  1274.       Page range               Mode                 Adapter
  1275.  
  1276.        0 - 7                   0                    CGA
  1277.        0 - 7                   1                    CGA
  1278.        0 - 3                   2                    CGA
  1279.        0 - 3                   3                    CGA
  1280.        0 - 7                   2                    EGA
  1281.        0 - 7                   3                    EGA
  1282.        0 - 7                   13                   EGA
  1283.        0 - 3                   14                   EGA
  1284.        0 - 1                   15                   EGA
  1285.        0 - 1                   16                   EGA
  1286.  
  1287.  
  1288.       Changing pages has no effect on their contents and text can be written to
  1289.       any page regardless of which page is active.
  1290.  
  1291.       Using multiple pages is not possible on a monochrome monitor with an MDA
  1292.       adapter.
  1293.  
  1294.       Function% must be initialized to 0 or 1 prior to calling BSVSPAG.  If
  1295.       Function% is 0 then Page% must be initialized to a valid page number.
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.                        Copyright (c) 1987, AJM Software 
  1316.                                    -Page 19-
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.       BSVSCRUP - Scroll up or clear a window
  1330.  
  1331.       Usage - Call BsVScrup(Lines%, FgColor%, BgColor%, Ulc%, Ulr%, Lrc%, Lrr%)
  1332.  
  1333.          Lines%       Number of lines to scroll up.  If Lines% is zero, then the
  1334.                       entire window is blanked.
  1335.  
  1336.          FgColor%     Foreground color - 0 thru 31 are valid foreground colors.
  1337.  
  1338.          BgColor%     Background color - 0 thru 7 are valid background colors.
  1339.  
  1340.          Ulc%         Coordinate of the left column of the scroll window.
  1341.                       1 indicates the far left column.
  1342.  
  1343.          Ulr%         Coordinate of the top row of the scroll window.  1 indi-
  1344.                       cates the top row of the screen.
  1345.  
  1346.          Lrc%         Coordinate of the right column of the scroll window.  80
  1347.                       is the far right column.
  1348.  
  1349.          Lrr%         Coordinate of the bottom row of the scroll window.  25 is
  1350.                       the last row of the screen.
  1351.  
  1352.       Programming notes:
  1353.  
  1354.       This function affects only the currently active display page and any data
  1355.       scrolled off of the window is lost.  Blank lines are inserted at the bot-
  1356.       tom of the window.  If the number of lines to scroll equals zero, then the
  1357.       entire window is blanked out.
  1358.  
  1359.       All fields must be initialized prior to calling BSVSCRUP.
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.                        Copyright (c) 1987, AJM Software 
  1382.                                    -Page 20-
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.       BSVSCRDN - Scroll down or clear a window
  1396.  
  1397.       Usage - Call BsVScrdn(Lines%, FgColor%, BgColor%, Ulc%, Ulr%, Lrc%, Lrr%)
  1398.  
  1399.          Lines%       Number of lines to scroll down.  If Lines% is zero, then
  1400.                       the entire window is blanked.
  1401.  
  1402.          FgColor%     Foreground color - 0 thru 31 are valid foreground colors.
  1403.  
  1404.          BgColor%     Background color - 0 thru 7 are valid background colors.
  1405.  
  1406.          Ulc%         Coordinate of the left column of the scroll window.
  1407.                       1 indicates the far left column.
  1408.  
  1409.          Ulr%         Coordinate of the top row of the scroll window.  1 indi-
  1410.                       cates the top row of the screen.
  1411.  
  1412.          Lrc%         Coordinate of the right column of the scroll window.  80
  1413.                       is the far right column.
  1414.  
  1415.          Lrr%         Coordinate of the bottom row of the scroll window.  25 is
  1416.                       the last row of the screen.
  1417.  
  1418.       Programming notes:
  1419.  
  1420.       This function affects only the currently active display page and any data
  1421.       scrolled off of the window is lost.  Blank lines are inserted at the top
  1422.       of the window.  If the number of lines to scroll equals zero, then the
  1423.       entire window is blanked out.
  1424.  
  1425.       All fields must be initialized prior to calling BSVSCRDN.
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.                        Copyright (c) 1987, AJM Software 
  1448.                                    -Page 21-
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462.       BSVRCHR  - Read a character and attribute from the screen
  1463.  
  1464.       Usage - Call BsVRChr(Char$, FgColor%, BgColor%, Row%, Col%, Page%)
  1465.  
  1466.          Char$        Character read from the screen.
  1467.  
  1468.          FgColor%     Foreground color
  1469.  
  1470.          BgColor%     Background color
  1471.  
  1472.          Row%         Coordinate of the character to read from the screen.
  1473.  
  1474.          Col%         Coordinate of the character to read from the screen.
  1475.  
  1476.          Page%        Display page to read
  1477.  
  1478.  
  1479.  
  1480.       Programming notes:
  1481.  
  1482.       Char$ should be initialized to a single space prior to using this service.
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.                        Copyright (c) 1987, AJM Software 
  1514.                                    -Page 22-
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.       BSVWCHR  - Write a character to the screen
  1530.  
  1531.       Usage - Call BsVWChr(Char$, FgColor%, BgColor%, Row%, Col%, Page%)
  1532.  
  1533.          Char$        Character to write to the screen.
  1534.  
  1535.          FgColor%     Foreground color
  1536.  
  1537.          BgColor%     Background color
  1538.  
  1539.          Row%         Coordinate of the character to write to the screen.
  1540.  
  1541.          Col%         Coordinate of the character to write to the screen.
  1542.  
  1543.          Page%        Display page to be written to
  1544.  
  1545.  
  1546.  
  1547.       Programming notes:
  1548.  
  1549.       All fields should be properly initialized before using this service.
  1550.  
  1551.       The current cursor position is not affected by this service.
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.                        Copyright (c) 1987, AJM Software 
  1580.                                    -Page 23-
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.       BSVWTTY  - Write in teletype mode
  1595.  
  1596.       Usage - Call BsVWTTY(Text$, FgColor%, BgColor%)
  1597.  
  1598.          Text$          Text to be written to the screen.
  1599.  
  1600.          FgColor%       Foreground Color
  1601.  
  1602.          BgColor        Background color
  1603.  
  1604.  
  1605.       Programming notes:
  1606.  
  1607.       This service recognizes special ASCII codes for bell, line feed, and back-
  1608.       space.  Any other characters are written to the screen and the cursor
  1609.       position is advanced appropriately.
  1610.  
  1611.       Do not mix this service with BASIC PRINT statements as the cursor posi-
  1612.       tioning will be inconsistent.
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.                        Copyright (c) 1987, AJM Software 
  1646.                                    -Page 24-
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.                               The BIOS Keyboard Services
  1660.  
  1661.  
  1662.  
  1663.       Function Summary
  1664.  
  1665.  
  1666.       BSKGET   - Get a character from the keyboard
  1667.  
  1668.       BSKSTAT  - Determine the status of the toggle keys
  1669.  
  1670.       BSKCLR   - Clear the keyboard buffer
  1671.  
  1672.       BSKNXT   - Preview the keyboard buffer
  1673.  
  1674.       BSKSTOG  - Set keyboard toggles
  1675.  
  1676.       BSKTOGH  - Determine whether toggle keys are pressed
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.                        Copyright (c) 1987, AJM Software 
  1712.                                    -Page 25-
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.       BSKGET   - Get a character from the keyboard
  1726.  
  1727.       Usage - Call BsKGet(Char$, Scancode%)
  1728.  
  1729.          Char$        The character entered at the keyboard.
  1730.  
  1731.          Scancode%    The scan code of the character entered at the keyboard.
  1732.                       A partial list of scancodes is provided in Appendix A.
  1733.  
  1734.  
  1735.       Programming notes:
  1736.  
  1737.       This function retrieves the next character in the keyboard buffer.  If
  1738.       there is nothing in the buffer, it will wait until a character is ready
  1739.       and thereby suspend program execution.  BSKNXT, discussed later, will
  1740.       allow you to peek into the keyboard buffer to determine if a key has been
  1741.       pressed without suspending the program.
  1742.  
  1743.       Char$ will either the standard ASCII code of the key pressed or CHR$(0) if
  1744.       a special key was pressed (i.e. the function keys, PgUp, Home, etc.).  If
  1745.       Char$ is a CHR$(0), then Scancode% will indicate which key was pressed.
  1746.       See Appendix A for a list of scancodes.
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.                        Copyright (c) 1987, AJM Software 
  1778.                                    -Page 26-
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.       BSKSTAT  - Determine the status of the toggle keys
  1792.  
  1793.       Usage - 
  1794.       Call BsKStat(Insert%, Caps%, Num%, Scroll%, Alt%, Ctrl%, LShift%, RShift%)
  1795.  
  1796.  
  1797.       Programming notes:
  1798.  
  1799.       For Insert%, Caps%, Num%, and Scroll% - If the returned value is 1, then
  1800.       that mode has been toggled on (i.e. - Caps light is on).  If the value
  1801.       returned is 0, then that mode has been toggled off.
  1802.  
  1803.       For Alt%, Ctrl%, LShift%, RShift% - If the returned value is 1, then that
  1804.       key is currently depressed.  If the value is 0, then that key is not
  1805.       depressed.
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.                        Copyright (c) 1987, AJM Software 
  1844.                                    -Page 27-
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.       BSKCLR   - Clear the keyboard buffer
  1858.  
  1859.       Usage - Call BsKClr
  1860.  
  1861.  
  1862.       Programming notes:
  1863.  
  1864.       BSKCLR is not passed any parameters, nor does it return any values.  It
  1865.       simply clears any keystrokes that have not been read into your program but
  1866.       are waiting in the keyboard buffer.
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.                        Copyright (c) 1987, AJM Software 
  1910.                                    -Page 28-
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922.  
  1923.       BSKNXT   - Preview the keyboard buffer
  1924.  
  1925.       Usage - Call BsKNxt(Char$, Scancode%, Rc%)
  1926.  
  1927.          Char$        The character entered at the keyboard.
  1928.  
  1929.          Scancode%    The scan code of the character entered at the keyboard.
  1930.                       A partial list of scancodes is provided in Appendix A.
  1931.  
  1932.          Rc%          Return code 0 indicates that no key has been pressed.
  1933.                       Return code 1 indicates that a key has been pressed.
  1934.  
  1935.  
  1936.       Programming notes:
  1937.  
  1938.       This function will not remove a character from the keyboard buffer.  If
  1939.       the return code indicates that a character is in the buffer, you must use
  1940.       BSKGET to get the character out of the buffer.
  1941.  
  1942.       See notes for BSKGET and Appendix A.
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.                        Copyright (c) 1987, AJM Software 
  1976.                                    -Page 29-
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989.       BSKSTOG  - Set keyboard toggles
  1990.  
  1991.       Usage - Call BsKSTog(Insert%, Caps%, Num%, Scroll%)
  1992.  
  1993.  
  1994.       Programming notes:
  1995.  
  1996.       Each parameter must be initialized to 0 or 1.  If the parameter is ini-
  1997.       tialized to 1 then that toggle will be turned on.  If the parameter is 0
  1998.       then that toggle will be turned off.  For example:
  1999.  
  2000.          Call BsKSTog(0,1,1,0)
  2001.  
  2002.       will turn CapsLock and NumLock on, and it will turn ScrollLock and Insert
  2003.       mode off.
  2004.  
  2005.  
  2006.  
  2007.  
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018.  
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.                        Copyright (c) 1987, AJM Software 
  2042.                                    -Page 30-
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.  
  2054.  
  2055.       BSKTOGH  - Determine whether toggle keys are pressed
  2056.  
  2057.       Usage - Call BsKTogH(Insert%, Caps%, Num%, Scroll%)
  2058.  
  2059.  
  2060.       Programming notes:
  2061.  
  2062.       No parameters need to be initialized prior to making this call.  If any of
  2063.       the returned values is 1, that indicates that the corresponding key is
  2064.       currently being held down.  If any of the returned values is 0, that indi-
  2065.       cates that the corresponding key is not currently being held down.
  2066.  
  2067.       Note that this function does not tell us the status of the toggle keys,
  2068.       only whether or not someone is physically pressing them at that moment.
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.                        Copyright (c) 1987, AJM Software 
  2108.                                    -Page 31-
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.                               The BIOS Diskette Services
  2121.  
  2122.  
  2123.  
  2124.       Function Summary
  2125.  
  2126.  
  2127.       BSDSTAT  - Get diskette controller status
  2128.  
  2129.       BSDRESET - Reset floppy disk controller
  2130.  
  2131.       BSDVRFY  - Verify sectors on a diskette
  2132.  
  2133.       BSDREAD  - Read a sector from a diskette
  2134.  
  2135.       BSDWRIT  - Write a sector to diskette
  2136.  
  2137.       BSDFMT   - Format a track on a diskette
  2138.  
  2139.  
  2140.  
  2141.       *********************** IMPORTANT *************************
  2142.  
  2143.       Before using any of these functions, please read the documentation care-
  2144.       fully and when testing your programs, please use blank diskettes.  These
  2145.       functions will also work with a hard disk, so if you have a hard disk
  2146.       installed, please take extra precautions.
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.                        Copyright (c) 1987, AJM Software 
  2174.                                    -Page 32-
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186.  
  2187.       BSDSTAT  - Get diskette controller status
  2188.  
  2189.       Usage Call BsDStat(Rc%)
  2190.  
  2191.       Rc%     Reason - Diskette drives only
  2192.  
  2193.       0       Successful
  2194.       1       Invalid function
  2195.       2       Address mark not found
  2196.       3       Write protect error
  2197.       4       Sector not found
  2198.       6       Diskette change detected
  2199.       8       DMA failure
  2200.       9       DMA boundary overrun
  2201.       16      bad CRC: parity check
  2202.       32      controller malfunction
  2203.       64      seek failure - move to requested track failed
  2204.       128     time out - drive did not respond (the door is open)
  2205.  
  2206.       Rc%     Reason - Hard disk drives only
  2207.  
  2208.       0       Successful
  2209.       1       Invalid function
  2210.       2       Address mark not found
  2211.       4       Sector not found
  2212.       5       Reset failed
  2213.       7       Drive parameter activity failed
  2214.       9       DMA boundary overrun
  2215.       10      Bad block flag detected
  2216.       16      Uncorrectable ECC data error
  2217.       17      ECC corrected data error
  2218.       32      controller malfunction
  2219.       64      seek failure - move to requested track failed
  2220.       128     time out - drive did not respond
  2221.       170     Drive not ready
  2222.       187     Undefined error occured
  2223.       204     Write fault active
  2224.       255     Sense operation failed
  2225.  
  2226.  
  2227.       Programming notes:
  2228.  
  2229.       This function always returns the status of the last disk operation.
  2230.  
  2231.       The messages normally seen when accessing a diskette with DOS, such as:
  2232.          Not ready error reading drive a
  2233.          Abort, Retry, Ignore
  2234.       will not be seen when using this function (and any other BIOS diskette
  2235.       function), therefore, you must always determine whether a disk operation
  2236.       has failed or succeeded when using the BIOS disk services.
  2237.  
  2238.  
  2239.                        Copyright (c) 1987, AJM Software 
  2240.                                    -Page 33-
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.  
  2252.  
  2253.       BSDRESET - Reset floppy disk controller
  2254.  
  2255.       Usage - Call BsDReset
  2256.  
  2257.  
  2258.       Programming notes:
  2259.  
  2260.       This function resets the disk controller and prepares it for I/O.  It will
  2261.       force the BIOS diskette support routines to recalibrate the disk drive's
  2262.       read/write head.  It should be used only after an error is detected during
  2263.       a disk drive operation.
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.                        Copyright (c) 1987, AJM Software 
  2306.                                    -Page 34-
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.  
  2318.  
  2319.       BSDVRFY  - Verify sectors on a disk
  2320.  
  2321.       Usage - Call BsDVrfy(Buffer$, Drive$, Head%, Track%, Sector%, Rc%)
  2322.  
  2323.          Buffer$        Not used for this function.
  2324.  
  2325.          Drive$         Letter designation for to drive containing the diskette
  2326.                         to be verified.
  2327.  
  2328.          Head%          Cylinder head
  2329.  
  2330.          Track%         Track containing sector to be verified.
  2331.  
  2332.          Sector%        Relative ID of the sector to be verified.
  2333.  
  2334.          Rc%            Return code - see function BSDSTAT
  2335.  
  2336.  
  2337.       Programming notes:
  2338.  
  2339.       For 1.2 Meg drives, the diskette drive parameter table must reflect the
  2340.       type of media installed for correct operation.  It is the responsibility
  2341.       of the programmer to ensure that the diskette drive parameter table is
  2342.       correct.  Unpredictable results can occur otherwise (See BSDASTYP).
  2343.  
  2344.  
  2345.       This service will verify only a single sector with each call.  If needed,
  2346.       the Assembler source can easily be modified to verify more than one
  2347.       sector (up to an entire track).
  2348.  
  2349.       The verify service reads the specified sector and insures that it passes
  2350.       the CRC check.
  2351.  
  2352.       See Appendix C - Miscellaneous diskette information.
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.                        Copyright (c) 1987, AJM Software 
  2372.                                    -Page 35-
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.  
  2384.  
  2385.       BSDREAD  - Read a sector from a disk
  2386.  
  2387.       Usage - Call BsDRead(Buffer$, Drive$, Head%, Track%, Sector%, Rc%)
  2388.  
  2389.          Buffer$        The string where the data read from disk will be placed
  2390.                         into.
  2391.  
  2392.          Drive$         Letter designation for to drive containing the disk
  2393.                         to be read.
  2394.  
  2395.          Head%          Cylinder head containing the track to be read.
  2396.  
  2397.          Track%         Track containing sector to be read.
  2398.  
  2399.          Sector%        Relative ID of the sector to be read.
  2400.  
  2401.          Rc%            Return code - see function BSDSTAT
  2402.  
  2403.  
  2404.       Programming notes:
  2405.  
  2406.       It is the responsibility of the programmer to ensure that Buffer$ is long
  2407.       enough to hold the sector read from disk (usually 512 bytes).  If it is
  2408.       not long enough, the results are unpredictable.  Generally you will see a
  2409.       'String Space Corrupt' message returned from BASIC.
  2410.  
  2411.       This service will read only a single sector with each call.  If necessary,
  2412.       the Assembler source can easily be modified to read more than one sector
  2413.       (up to an entire track).
  2414.  
  2415.       See Appendix C - Miscellaneous diskette information.
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.                        Copyright (c) 1987, AJM Software 
  2438.                                    -Page 36-
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.  
  2450.  
  2451.       BSDWRIT  - Write a sector to disk
  2452.  
  2453.       Usage - Call BsDWrit(Buffer$, Drive$, Head%, Track%, Sector%, Rc%)
  2454.  
  2455.          Buffer$        The string containing the data to be written to disk.
  2456.  
  2457.          Drive$         Letter designation for to drive containing the disk
  2458.                         to be written
  2459.  
  2460.          Head%          Cylinder head containing the track to be written.
  2461.  
  2462.          Track%         Track containing sector to be written.
  2463.  
  2464.          Sector%        Relative ID of the sector to be written.
  2465.  
  2466.          Rc%            Return code - see function BSDSTAT
  2467.  
  2468.  
  2469.       Programming notes:
  2470.  
  2471.       When testing, first backup your diskette.  It is very easy to inadver-
  2472.       tently erase usable data or render a diskette unusable with this service.
  2473.  
  2474.       This service will always write a complete sector.  If Buffer$ is shorter
  2475.       than the length of a sector (usually 512 bytes), the contents of the sec-
  2476.       tor written will be unpredictable.
  2477.  
  2478.       This service will write only a single sector with each call.  If needed,
  2479.       the Assembler source can easily be modified to write more than one sector
  2480.       (up to an entire track).
  2481.  
  2482.       See Appendix C - Miscellaneous diskette information.
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.                        Copyright (c) 1987, AJM Software 
  2504.                                    -Page 37-
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.  
  2516.  
  2517.       BSDFMT   - Format a track on a disk
  2518.  
  2519.       Usage - Call BsDFmt(Buffer$, Drive$, Head%, Track%, Sector%, Rc%)
  2520.  
  2521.          Buffer$        The string containing the track format table (See Appen-
  2522.                         dix C).
  2523.  
  2524.          Drive$         Letter designation for to drive containing the diskette
  2525.                         to be formatted.
  2526.  
  2527.          Head%          Cylinder head containing the track to be formatted.
  2528.  
  2529.          Track%         Track containing sector to be formatted.
  2530.  
  2531.          Sector%        Number of sectors to be formatted.
  2532.  
  2533.          Rc%            Return code - see function BSDSTAT
  2534.  
  2535.  
  2536.       Programming notes:
  2537.  
  2538.  
  2539.       For 1.2 Meg drives, the diskette drive parameter table must reflect the
  2540.       type of media installed for correct operation.  It is the responsibility
  2541.       of the programmer to ensure that the diskette drive parameter table is
  2542.       correct.  Unpredictable results can occur otherwise (See BSDASTYP).
  2543.  
  2544.       When testing, first backup your diskette.  It is very easy to inadver-
  2545.       tently erase usable data or render a diskette unusable with this service.
  2546.  
  2547.       This service will always format a complete track.  If Sector% is less than
  2548.       the maximum number of sectors that can fit on that track, then the unfor-
  2549.       matted sectors will no longer be available.
  2550.  
  2551.       If you format track 0 on a diskette with this service, the diskette will
  2552.       not be usable until a boot record is written to sector 0.  If needed, the
  2553.       Assembler source code can be modified to write a boot record to the dis-
  2554.       kette.
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.                        Copyright (c) 1987, AJM Software 
  2570.                                    -Page 38-
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.  
  2582.  
  2583.  
  2584.                            The BIOS Miscellaneous Services
  2585.  
  2586.  
  2587.  
  2588.       Function Summary
  2589.  
  2590.  
  2591.       BSEQPMT  - Get installed equipment
  2592.  
  2593.       BSPINIT  - Initialize printer
  2594.  
  2595.       BSPSTAT  - Get printer status
  2596.  
  2597.       BSPRINT  - Print a string of characters
  2598.  
  2599.       BSPRTSC  - Print screen
  2600.  
  2601.  
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.                        Copyright (c) 1987, AJM Software 
  2636.                                    -Page 39-
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.  
  2648.  
  2649.       BSEQPMT  - Get installed equipment
  2650.  
  2651.       Usage -
  2652.       Call BsEqpmt(RomDate$, RAM%, ExtRAM%, ExpRAM%, Printers%, RS232%,
  2653.       Floppies%, Gameport%, Disks%)
  2654.  
  2655.          RomDate$       ROM-BIOS revision date
  2656.  
  2657.          RAM%           Amount, in Kilobytes, of installed RAM.
  2658.  
  2659.          ExtRAM%        Amount, in Kilobytes, of extended memory.
  2660.  
  2661.          ExpRAM%        Amount, in 16K pages, of LIMM expanded memory.
  2662.  
  2663.          Printers%      Number of printer ports installed.
  2664.  
  2665.          Rs232%         Number of serial ports installed.
  2666.  
  2667.          Floppies%      Number of floppy disk drives installed.
  2668.  
  2669.          Gameport%      Number of gameports installed.
  2670.  
  2671.          Disks%         Number of hard disks installed.
  2672.  
  2673.  
  2674.       Programming notes:
  2675.  
  2676.       Some of these fields may not be reliable in certain hardware configura-
  2677.       tions.  Items to be wary about are RomDate$, ExtRAM%, and in particular,
  2678.       the number of hard disks.
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.                        Copyright (c) 1987, AJM Software 
  2702.                                    -Page 40-
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.  
  2711.  
  2712.  
  2713.  
  2714.  
  2715.       BSPINIT  - Initialize printer
  2716.  
  2717.       Usage - Call BsPInit(Printer%, Rc%)
  2718.  
  2719.          Printer%       The printer port number - 0 is LPT1, 1 is LPT2, etc.
  2720.  
  2721.          Rc%            Return code - see BSPSTAT
  2722.  
  2723.  
  2724.       Programming notes:
  2725.  
  2726.       This service will initialize the printer.  That is to say, it will:
  2727.  
  2728.          - Reset top-of-form
  2729.          - Return the printer to its default setup
  2730.          - poll the printer for printer status
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.                        Copyright (c) 1987, AJM Software 
  2768.                                    -Page 41-
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.  
  2777.  
  2778.  
  2779.  
  2780.  
  2781.       BSPSTAT  - Get printer status
  2782.  
  2783.       Usage - Call BsPStat(Printer%, Rc%)
  2784.  
  2785.          Printer%       The printer port number - 0 is LPT1, 1 is LPT2, etc.
  2786.  
  2787.          Rc%            Return code
  2788.  
  2789.  
  2790.       Programming notes:
  2791.  
  2792.       The return code is actually a series of bit settings that indicates the
  2793.       following conditions:
  2794.  
  2795.          -  Printer ready
  2796.          -  Acknowledge
  2797.          -  Out of paper
  2798.          -  I/O error (on some printers, this indicates an off-line condition)
  2799.          -  Timeout
  2800.          -  Selected
  2801.  
  2802.       When checking printer status, the 'selected' indicator tells you that the
  2803.       printer is on-line and ready to go.  Some printers will return a "Printer
  2804.       ready' status even when turned off (this, incidentally, is why Quickbasic
  2805.       will occasionally print to a printer that is turned off and never return
  2806.       an error condition).  Before issuing an LPRINT (or equivalent) command in
  2807.       Quickbasic, make sure that the printer is selected.
  2808.  
  2809.  
  2810.  
  2811.  
  2812.       ***************************** IMPORTANT *********************************
  2813.  
  2814.  
  2815.       See the next page for a Quickbasic program segment that properly inter-
  2816.       prets Rc%.
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.                        Copyright (c) 1987, AJM Software 
  2834.                                    -Page 42-
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.  
  2843.  
  2844.  
  2845.  
  2846.       The following code segment will extract the appropriate values.  It is
  2847.       included in the sample program archive(Registered owners only).
  2848.  
  2849.  
  2850.       Printer%          = 0                     'Use LPT1
  2851.       Call BsPStat(Printer%, Rc%)               'Get status of printer
  2852.  
  2853.       Printer.Ready%  =  (Rc% and 128) = 128   '1st bit indicates printer ready
  2854.       Acknowledge%    =  (Rc% and 64)  = 64    '2nd bit indicates Ack
  2855.       Out.of.Paper%   =  (Rc% and 32)  = 32    '3rd bit indicates out of paper
  2856.       IO.Error%       =  (Rc% and 8)   = 8     '5th bit indicates I/O Error
  2857.       Timeout%        =  (Rc% and 1)   = 1     '8th bit indicates Timeout
  2858.       Selected%       =  (Rc% and 16)  = 16    '4th bit indicates Selected
  2859.  
  2860.       Locate 1,1: Color 15,1: Cls
  2861.  
  2862.       If Printer.Ready% then
  2863.          Print "Printer at LPT1 reports Ready"
  2864.       End if
  2865.  
  2866.       If Acknowledge% then
  2867.          Print "Printer at LPT1 reports Acknowledge"
  2868.       End if
  2869.  
  2870.       If Out.of.Paper% then
  2871.          Print "Printer at LPT1 reports Out of Paper of Paper jam"
  2872.       End if
  2873.  
  2874.       If IO.Error% then
  2875.          Print "Printer at LPT1 reports I/O error or Printer off-line"
  2876.       End if
  2877.  
  2878.       If Timeout% then
  2879.          Print "Printer at LPT1 has timed out"
  2880.       End if
  2881.  
  2882.       If Selected% then
  2883.          Print "Printer at LPT1 is selected"
  2884.       End if
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.                        Copyright (c) 1987, AJM Software 
  2900.                                    -Page 43-
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  
  2913.       BSPRINT  - Print a string of characters
  2914.  
  2915.       Usage - Call BsPrint(Text$, Printer%, Rc%)
  2916.  
  2917.          Text$          String to print
  2918.  
  2919.          Printer%       Printer port
  2920.  
  2921.          Rc%            Return code
  2922.  
  2923.  
  2924.       Programming notes:
  2925.  
  2926.       See BSPSTAT for an explanation of return codes.
  2927.  
  2928.       This service sends whatever is in Text$ to the appropriate printer port.
  2929.       All special printer codes such as NewLine, TopofForm, etc, will be inter-
  2930.       preted correctly by the printer.
  2931.  
  2932.  
  2933.  
  2934.  
  2935.  
  2936.  
  2937.  
  2938.  
  2939.  
  2940.  
  2941.  
  2942.  
  2943.  
  2944.  
  2945.  
  2946.  
  2947.  
  2948.  
  2949.  
  2950.  
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.                        Copyright (c) 1987, AJM Software 
  2966.                                    -Page 44-
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974.  
  2975.  
  2976.  
  2977.  
  2978.       BSPRTSC  - Print screen
  2979.  
  2980.       Usage - Call BsPrtSc
  2981.  
  2982.  
  2983.       Programming notes:
  2984.  
  2985.       This service is the equivalent of pressing the 'PrtSc' key on the key-
  2986.       board.
  2987.  
  2988.       The screen will be printed to LPT1.
  2989.  
  2990.  
  2991.  
  2992.  
  2993.  
  2994.  
  2995.  
  2996.  
  2997.  
  2998.  
  2999.  
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.                        Copyright (c) 1987, AJM Software 
  3032.                                    -Page 45-
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.  
  3041.  
  3042.  
  3043.  
  3044.  
  3045.                               The BIOS AT Disk Services
  3046.  
  3047.  
  3048.  
  3049.       Function Summary
  3050.  
  3051.  
  3052.       BSDAPARM - Get current drive parameters
  3053.  
  3054.       BSDATST  - Test for drive ready
  3055.  
  3056.       BSDARST  - Alternate disk reset
  3057.  
  3058.       BSDARCL  - Recalibrate drive
  3059.  
  3060.       BSDADIAG - Perform controller diagnostics
  3061.  
  3062.       BSDASTAT - Detect diskette change
  3063.  
  3064.       BSDATYPE - Get disk type
  3065.  
  3066.       BSDASTYP - Set diskette type
  3067.  
  3068.       BSDASEEK - Position heads over a specified cylinder
  3069.  
  3070.  
  3071.  
  3072.       *********************** IMPORTANT *************************
  3073.  
  3074.       These functions are documented only for AT type machines.  These machines
  3075.       generally use a 1.2 Meg diskette drive whose characteristics are different
  3076.       enough from the 360KB drive to warrant these new BIOS services.  These
  3077.       services also provide additional support for hard disks.
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.                        Copyright (c) 1987, AJM Software 
  3098.                                    -Page 46-
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.  
  3107.  
  3108.  
  3109.  
  3110.  
  3111.       BSDAPARM - Get current drive parameters
  3112.  
  3113.       Usage - Call BsDAParm(Drive$, Heads%, Cylinders%, Sectors%)
  3114.  
  3115.          Drive$         Letter designation of the target drive
  3116.  
  3117.          Heads%         Maximum number of heads on the disk
  3118.  
  3119.          Cylinders%     Maximum number of Cylinders/Head
  3120.  
  3121.          Sectors%       Maximum number of Sectors/Cylinder
  3122.  
  3123.  
  3124.       Programming notes:
  3125.  
  3126.       This service will not function on a diskette drive.  It is intended for
  3127.       use with a hard disk only.
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.  
  3143.  
  3144.  
  3145.  
  3146.  
  3147.  
  3148.  
  3149.  
  3150.  
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.                        Copyright (c) 1987, AJM Software 
  3164.                                    -Page 47-
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.  
  3173.  
  3174.  
  3175.  
  3176.  
  3177.  
  3178.       BSDATST  - Test for drive ready
  3179.  
  3180.       Usage - Call DsDATst(Drive$, Rc%)
  3181.  
  3182.          Drive$         Letter designation of the target drive
  3183.  
  3184.          Rc%            Return code
  3185.  
  3186.  
  3187.       Programming notes:
  3188.  
  3189.       This service will not function on a diskette drive.  It is intended for
  3190.       use with a hard disk only.
  3191.  
  3192.       This service tests the status of the DRIVE READY signal on the selected
  3193.       drive.
  3194.  
  3195.       See BSDSTAT documentation for an explanation of return codes.
  3196.  
  3197.  
  3198.  
  3199.  
  3200.  
  3201.  
  3202.  
  3203.  
  3204.  
  3205.  
  3206.  
  3207.  
  3208.  
  3209.  
  3210.  
  3211.  
  3212.  
  3213.  
  3214.  
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.                        Copyright (c) 1987, AJM Software 
  3230.                                    -Page 48-
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.       BSDARST  - Alternate disk reset
  3244.  
  3245.       Usage - Call BsDARst(Drive$, Rc%)
  3246.  
  3247.          Drive$         Letter designation of the target drive
  3248.  
  3249.          Rc%            Return code
  3250.  
  3251.  
  3252.       Programming notes:
  3253.  
  3254.       This service is the same as BSDRESET documented earlier except that
  3255.       BSDARST can be used only with hard disk controllers.
  3256.  
  3257.       See BSDSTAT documentation for an explanation of return codes.
  3258.  
  3259.  
  3260.  
  3261.  
  3262.  
  3263.  
  3264.  
  3265.  
  3266.  
  3267.  
  3268.  
  3269.  
  3270.  
  3271.  
  3272.  
  3273.  
  3274.  
  3275.  
  3276.  
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.                        Copyright (c) 1987, AJM Software 
  3296.                                    -Page 49-
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.  
  3308.  
  3309.       BSDARCL  - Recalibrate drive
  3310.  
  3311.       Usage - Call BsDARcl(Drive$, Rc%)
  3312.  
  3313.          Drive$         Letter designation of the target drive
  3314.  
  3315.          Rc%            Return code
  3316.  
  3317.  
  3318.       Programming notes:
  3319.  
  3320.       This service will not function on a diskette drive.  It is intended for
  3321.       use with a hard disk only.
  3322.  
  3323.       This service instructs the specified drive to recalibrate.  This is done
  3324.       by seeking track 0.
  3325.  
  3326.       This service should be used only after an error has been detected and
  3327.       before any retries are made.
  3328.  
  3329.       See BSDSTAT documentation for an explanation of return codes.
  3330.  
  3331.  
  3332.  
  3333.  
  3334.  
  3335.  
  3336.  
  3337.  
  3338.  
  3339.  
  3340.  
  3341.  
  3342.  
  3343.  
  3344.  
  3345.  
  3346.  
  3347.  
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.                        Copyright (c) 1987, AJM Software 
  3362.                                    -Page 50-
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.  
  3371.  
  3372.  
  3373.  
  3374.  
  3375.       BSDADIAG - Perform controller diagnostics
  3376.  
  3377.       Usage BsDADiag(Rc%)
  3378.  
  3379.          Rc%            Return code
  3380.  
  3381.  
  3382.       Programming notes:
  3383.  
  3384.       This service will not function on a diskette drive.  It is intended for
  3385.       use with a hard disk only.
  3386.  
  3387.       This service instructs the hard disk controller to perform its internal
  3388.       diagnostic routines.
  3389.  
  3390.       See BSDSTAT documentation for an explanation of return codes.
  3391.  
  3392.  
  3393.  
  3394.  
  3395.  
  3396.  
  3397.  
  3398.  
  3399.  
  3400.  
  3401.  
  3402.  
  3403.  
  3404.  
  3405.  
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.                        Copyright (c) 1987, AJM Software 
  3428.                                    -Page 51-
  3429.  
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436.  
  3437.  
  3438.  
  3439.  
  3440.  
  3441.       BSDASTAT - Detect diskette change
  3442.  
  3443.       Usage - Call BsDAStat(Drive$, Rc%)
  3444.  
  3445.          Drive$         Letter designation of the target drive
  3446.  
  3447.          Rc%            Return code
  3448.  
  3449.  
  3450.       Programming notes:
  3451.  
  3452.       This service will detect whether or not the disk drive door has been
  3453.       opened since the last disk operation.  It is meaningless for hard drives.
  3454.  
  3455.       This service should be used only with those drives that can detect disk
  3456.       changes (See BSDATYPE).
  3457.  
  3458.       See BSDSTAT documentation for an explanation of return codes.
  3459.  
  3460.  
  3461.  
  3462.  
  3463.  
  3464.  
  3465.  
  3466.  
  3467.  
  3468.  
  3469.  
  3470.  
  3471.  
  3472.  
  3473.  
  3474.  
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.  
  3481.  
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.                        Copyright (c) 1987, AJM Software 
  3494.                                    -Page 52-
  3495.  
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502.  
  3503.  
  3504.  
  3505.  
  3506.  
  3507.       BSDATYPE - Get disk type
  3508.  
  3509.       Usage - Call BsDAType(Drive$, Rc%)
  3510.  
  3511.          Drive$         Letter designation of the target drive
  3512.  
  3513.          Rc%            0 - drive is not present
  3514.                         1 - diskette without change detection
  3515.                         2 - diskette with change detection%
  3516.                         3 - fixed disk
  3517.  
  3518.  
  3519.       Programming notes:
  3520.  
  3521.       This service will work with both hard and floppy disk drives.
  3522.  
  3523.  
  3524.  
  3525.  
  3526.  
  3527.  
  3528.  
  3529.  
  3530.  
  3531.  
  3532.  
  3533.  
  3534.  
  3535.  
  3536.  
  3537.  
  3538.  
  3539.  
  3540.  
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.                        Copyright (c) 1987, AJM Software 
  3560.                                    -Page 53-
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.  
  3570.  
  3571.  
  3572.  
  3573.       BSDASTYP - Set diskette type
  3574.  
  3575.       Usage - Call BsDASTyp(Drive$, Type%, Rc%)
  3576.  
  3577.          Drive$         Letter designation of the target drive
  3578.  
  3579.          Type%          1 - Double-density drive
  3580.                         2 - 360KB diskette in a 1.2MB drive
  3581.                         3 - 1.2MB diskette in a 1.2MB drive
  3582.  
  3583.          Rc%            Return code
  3584.  
  3585.  
  3586.       Programming notes:
  3587.  
  3588.       This service is meaningless for fixed disks.
  3589.  
  3590.       This service should be used prior to all Format and Verify requests to any
  3591.       1.2MB diskette drives.
  3592.  
  3593.       See BSDSTAT for an explanation of return codes.
  3594.  
  3595.  
  3596.  
  3597.  
  3598.  
  3599.  
  3600.  
  3601.  
  3602.  
  3603.  
  3604.  
  3605.  
  3606.  
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.                        Copyright (c) 1987, AJM Software 
  3626.                                    -Page 54-
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.  
  3638.  
  3639.  
  3640.       BSDASEEK - Position heads over a specified cylinder
  3641.  
  3642.       Usage - Call BsDASeek(Drive$, Head%, Cylinder%, Rc%)
  3643.  
  3644.          Drive$         Letter designation of the target drive
  3645.  
  3646.          Head%          Head to be positioned
  3647.  
  3648.          Cylinder%      Cylinder over which the head will be positioned.
  3649.  
  3650.          Rc%            Return code
  3651.  
  3652.  
  3653.       Programming notes:
  3654.  
  3655.       This service will not function on a diskette drive.  It is intended for
  3656.       use with a hard disk only.
  3657.  
  3658.       This service can be used to park your fixed disk
  3659.  
  3660.       See BSDSTAT for an explanation of return codes.
  3661.  
  3662.  
  3663.  
  3664.  
  3665.  
  3666.  
  3667.  
  3668.  
  3669.  
  3670.  
  3671.  
  3672.  
  3673.  
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679.  
  3680.  
  3681.  
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.                        Copyright (c) 1987, AJM Software 
  3692.                                    -Page 55-
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.  
  3701.  
  3702.  
  3703.  
  3704.  
  3705.                              The File Attribute Services
  3706.  
  3707.  
  3708.       Function Summary
  3709.  
  3710.  
  3711.       FLGTIM   - Get file creation time
  3712.  
  3713.       FLGDAT   - Get file creation date
  3714.  
  3715.       FLGVOL   - Get volume label
  3716.  
  3717.       FLPDAT   - Change file creation date and time
  3718.  
  3719.       FLPVOL   - Change volume label
  3720.  
  3721.       FLATTR   - Change file attributes
  3722.  
  3723.  
  3724.  
  3725.  
  3726.  
  3727.  
  3728.  
  3729.  
  3730.  
  3731.  
  3732.  
  3733.  
  3734.  
  3735.  
  3736.  
  3737.  
  3738.  
  3739.  
  3740.  
  3741.  
  3742.  
  3743.  
  3744.  
  3745.  
  3746.  
  3747.  
  3748.  
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.                        Copyright (c) 1987, AJM Software 
  3758.                                    -Page 56-
  3759.  
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766.  
  3767.  
  3768.  
  3769.  
  3770.  
  3771.  
  3772.       FLGTIM   - Get file creation time
  3773.  
  3774.       Usage - Call FlGTim(FlSpec$, FlTime$, Rc%)
  3775.  
  3776.          FlSpec$        Standard ASCIIZ file name
  3777.  
  3778.          FlTime$        File creation time in HH:MM:SS format
  3779.  
  3780.          Rc%            Return code
  3781.  
  3782.  
  3783.       Programming notes:
  3784.  
  3785.       See function FLFIND for additional capabilities.
  3786.  
  3787.       An ASCIIZ string is the standard DOS filename followed by CHR$(0)
  3788.  
  3789.       FlTime$ must be initialized to 8 blanks prior to calling FLGTIM.  If it is
  3790.       not properly initialized, a 'String Space Corrupt' error may occur.
  3791.  
  3792.       See Appendix D for valid return codes.
  3793.  
  3794.       Use FLFIND instead of FLGTIM whenever possible because it is tremendously
  3795.       faster.
  3796.  
  3797.  
  3798.  
  3799.  
  3800.  
  3801.  
  3802.  
  3803.  
  3804.  
  3805.  
  3806.  
  3807.  
  3808.  
  3809.  
  3810.  
  3811.  
  3812.  
  3813.  
  3814.  
  3815.  
  3816.  
  3817.  
  3818.  
  3819.  
  3820.  
  3821.  
  3822.  
  3823.                        Copyright (c) 1987, AJM Software 
  3824.                                    -Page 57-
  3825.  
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832.  
  3833.  
  3834.  
  3835.  
  3836.  
  3837.       FLGDAT   - Get file creation date
  3838.  
  3839.       Usage - Call FlGDat(FlSpec$, FlDate$, Rc%)
  3840.  
  3841.          FlSpec$        Standard ASCIIZ file name
  3842.  
  3843.          FlDate$        File creation date in MM-DD-YYYY format
  3844.  
  3845.          Rc%            Return code
  3846.  
  3847.  
  3848.       Programming notes:
  3849.  
  3850.       See function FLFIND for additional capabilities.
  3851.  
  3852.       An ASCIIZ string is the standard DOS filename followed by CHR$(0)
  3853.  
  3854.       FlDate$ must be initialized to 10 blanks prior to calling FLGDAT.  If it
  3855.       is not properly initialized, a 'String Space Corrupt' error may occur.
  3856.  
  3857.       See Appendix D for valid return codes.
  3858.  
  3859.       Use FLFIND instead of FLGDAT whenever possible because it is tremendously
  3860.       faster.
  3861.  
  3862.  
  3863.  
  3864.  
  3865.  
  3866.  
  3867.  
  3868.  
  3869.  
  3870.  
  3871.  
  3872.  
  3873.  
  3874.  
  3875.  
  3876.  
  3877.  
  3878.  
  3879.  
  3880.  
  3881.  
  3882.  
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.                        Copyright (c) 1987, AJM Software 
  3890.                                    -Page 58-
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898.  
  3899.  
  3900.  
  3901.  
  3902.  
  3903.       FLGVOL   - Get volume label
  3904.  
  3905.       Usage - Call FlGVol(Drive$, Vol$)
  3906.  
  3907.          Drive$         Letter designation of drive
  3908.  
  3909.          Vol$           Volume label of the target drive
  3910.  
  3911.  
  3912.       Programming notes:
  3913.  
  3914.       Vol$ must be initialized to 11 blanks prior to calling FLGVOL.  If it
  3915.       is not properly initialized, the entire volume label may not be returned
  3916.       in this field.
  3917.  
  3918.       No return code is provided for this function.  If an invalid Drive letter
  3919.       is passed or if the target drive does not have a volume label, the con-
  3920.       tents of Vol$ will remain unchanged.
  3921.  
  3922.       If Drive$ is initialized to nulls (i.e. Drive$ = "").  The volume label of
  3923.       the default drive is returned.
  3924.  
  3925.  
  3926.  
  3927.  
  3928.  
  3929.  
  3930.  
  3931.  
  3932.  
  3933.  
  3934.  
  3935.  
  3936.  
  3937.  
  3938.  
  3939.  
  3940.  
  3941.  
  3942.  
  3943.  
  3944.  
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950.  
  3951.  
  3952.  
  3953.  
  3954.  
  3955.                        Copyright (c) 1987, AJM Software 
  3956.                                    -Page 59-
  3957.  
  3958.  
  3959.  
  3960.  
  3961.  
  3962.  
  3963.  
  3964.  
  3965.  
  3966.  
  3967.  
  3968.  
  3969.  
  3970.       FLPDAT   - Change file creation date and time
  3971.  
  3972.       Usage - Call FlPDat(Flspec$, FlDate$, FlTime$, Rc%)
  3973.  
  3974.          FlSpec$        Standard ASCIIZ file name
  3975.  
  3976.          FlDate$        File creation date in MM-DD-YYYY format
  3977.  
  3978.          FlTime$        File creation time in HH:MM:SS format
  3979.  
  3980.          Rc%            Return code
  3981.  
  3982.  
  3983.       Programming notes:
  3984.  
  3985.       See function FLFIND for additional capabilities.
  3986.  
  3987.       An ASCIIZ string is the standard DOS filename followed by CHR$(0)
  3988.  
  3989.       FlDate$ must be initialized to a valid 10 character date prior to calling
  3990.       FLPDAT.  If an invalid date is used or a date that is not 10 characters
  3991.       is used, FLPDAT will place garbage in the file creation date.  This is not
  3992.       harmful to the date contained in the file, but may interfere with some
  3993.       MAKE or Backup processes.
  3994.  
  3995.       FlTime$ must be initialized to a valid 8 character time prior to calling
  3996.       FLPDAT.  See discussion of FlDate$ for implications of using invalid
  3997.       times.
  3998.  
  3999.       See Appendix D for valid return codes.
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.                        Copyright (c) 1987, AJM Software 
  4022.                                    -Page 60-
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.  
  4031.  
  4032.  
  4033.  
  4034.  
  4035.       FLPVOL   - Change volume label
  4036.  
  4037.       Usage - Call FlPVol(Drive$, Vol$, Rc%)
  4038.  
  4039.          Drive$         Letter designation of drive
  4040.  
  4041.          Vol$           Volume label to be written to target drive
  4042.  
  4043.          Rc%            Return code
  4044.  
  4045.  
  4046.       Programming notes:
  4047.  
  4048.       Vol$ must be initialized to an 11 character string before calling FLPVOL.
  4049.       If it is not properly initialized, an incorrect volume label may be writ-
  4050.       ten to the disk.
  4051.  
  4052.       See Appendix D for return codes.
  4053.  
  4054.       If Drive$ is initialized to nulls (i.e. Drive$ = "").  The volume label of
  4055.       the default drive is updated.
  4056.  
  4057.  
  4058.  
  4059.  
  4060.  
  4061.  
  4062.  
  4063.  
  4064.  
  4065.  
  4066.  
  4067.  
  4068.  
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075.  
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.                        Copyright (c) 1987, AJM Software 
  4088.                                    -Page 61-
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096.  
  4097.  
  4098.  
  4099.       FLATTR   - Change file attributes
  4100.  
  4101.       Usage Call FlAttr(FlSpec$, Mode%, Attr%, Rc%)
  4102.  
  4103.          FlSpec$        Standard ASCIIZ file name
  4104.  
  4105.          Mode%          0 - Get attributes
  4106.                         1 - Set attributes
  4107.  
  4108.          Attr%          New file attributes (if Mode% = 1) or current file
  4109.                         attributes (if Mode% = 0).
  4110.  
  4111.          Rc%            Return code
  4112.  
  4113.  
  4114.       Programming notes:
  4115.  
  4116.       See function FLFIND for additional capabilities.
  4117.  
  4118.       An ASCIIZ string is the standard DOS filename followed by CHR$(0)
  4119.  
  4120.       Attr% is an integer between 0 and 63. Attributes are bit settings within
  4121.       this number and they are represented as:
  4122.  
  4123.               Normal    0
  4124.               Readonly  1
  4125.               Hidden    2
  4126.               System    4
  4127.               Volume    8
  4128.               Subdir   16
  4129.               Archive  32
  4130.  
  4131.  
  4132.  
  4133.       The following code segment will interpret the Attr% field.
  4134.  
  4135.  
  4136.          FlSpec$ = "command.com"+chr$(0)        'Target filename
  4137.          Mode%   = 0                            'Indicate get attributes
  4138.  
  4139.          Call FlAttr(FlSpec$, Mode%, Attr%, Rc%)
  4140.  
  4141.          If Rc% <> 0 then goto Error.Routine    'Non-zero indicates failure
  4142.  
  4143.          If Attr% = 0 then 
  4144.               Normal% = -1                      'zero indicates no special
  4145.               Goto Print.Attr                   'attributes
  4146.          End if
  4147.  
  4148.          FRead%   = (Attr% and 1)  = 1          'Check for readonly attr
  4149.          FHidden% = (Attr% and 2)  = 2          'Check for hidden attr
  4150.  
  4151.  
  4152.  
  4153.                        Copyright (c) 1987, AJM Software 
  4154.                                    -Page 62-
  4155.  
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162.  
  4163.  
  4164.  
  4165.  
  4166.  
  4167.  
  4168.          FSystem% = (Attr% and 4)  = 4          'Check for system attr
  4169.          FVolume% = (Attr% and 8)  = 8          'Check for Volume label
  4170.          FSubdir% = (Attr% and 16) = 16         'Check if its a sub-directory
  4171.          FArcive% = (Attr% and 32) = 32         'Check if its been archived
  4172.  
  4173.       Print.Attr:
  4174.          Attributes$ = ""
  4175.          If Normal%      then Attribute$ = "Normal "
  4176.          If FRead%       then Attribute$ = "Read Only "
  4177.          If Fhidden%     then Attribute$ = Attribute$ + "Hidden "
  4178.          If Fsystem%     then Attribute$ = Attribute$ + "System "
  4179.          If FSubdir%     then Attribute$ = Attribute$ + "Directory "
  4180.          If FArcive%     then Attribute$ = Attribute$ + "Archive"
  4181.  
  4182.          Print "FlSpec$", Attribute$
  4183.  
  4184.  
  4185.       A program segment in the Sample programs (Registered copies only) shows
  4186.       how to initialize Attr% to set attributes.
  4187.  
  4188.  
  4189.  
  4190.  
  4191.  
  4192.  
  4193.  
  4194.  
  4195.  
  4196.  
  4197.  
  4198.  
  4199.  
  4200.  
  4201.  
  4202.  
  4203.  
  4204.  
  4205.  
  4206.  
  4207.  
  4208.  
  4209.  
  4210.  
  4211.  
  4212.  
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.                        Copyright (c) 1987, AJM Software 
  4220.                                    -Page 63-
  4221.  
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228.  
  4229.  
  4230.  
  4231.  
  4232.  
  4233.                                The File Access Services
  4234.  
  4235.  
  4236.       Function Summary
  4237.  
  4238.  
  4239.       FLOPEN   - Open a file
  4240.  
  4241.       FLCLOS   - Close a file
  4242.  
  4243.       FLREAD   - Read a record from a file
  4244.  
  4245.       FLWRIT   - Write a record to a file
  4246.  
  4247.       FLPOINT  - Point to a specific record in a file
  4248.  
  4249.       FLCREAT  - Create a file
  4250.  
  4251.       FLDELETE - Delete a file
  4252.  
  4253.       FLRSECT  - Read a sector
  4254.  
  4255.       FLWSECT  - Write a sector
  4256.  
  4257.  
  4258.  
  4259.  
  4260.  
  4261.  
  4262.  
  4263.  
  4264.  
  4265.  
  4266.  
  4267.  
  4268.  
  4269.  
  4270.  
  4271.  
  4272.  
  4273.  
  4274.  
  4275.  
  4276.  
  4277.  
  4278.  
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285.                        Copyright (c) 1987, AJM Software 
  4286.                                    -Page 64-
  4287.  
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294.  
  4295.  
  4296.  
  4297.  
  4298.  
  4299.       FLOPEN   - Open a file
  4300.  
  4301.       Usage - Call FlOpen(FlSpec$, Mode%, Share%, Handle%, Rc%)
  4302.  
  4303.          FlSpec$        Valid ASCIIZ file name
  4304.  
  4305.          Mode%          Specifies the use mode - valid values are:
  4306.                                0 - Read only access
  4307.                                1 - Write only access
  4308.                                2 - Read/Write access
  4309.  
  4310.          Share%         Specifies the file sharing mode in multi-tasking envi-
  4311.                         ronments.  Valid values are:
  4312.                                1 - exclusive use
  4313.                                2 - allow read access only
  4314.                                3 - allow write access only
  4315.                                4 - allow read/write access(full sharing)
  4316.  
  4317.          Handle%        Token returned by DOS to identify the opened file.
  4318.  
  4319.          Rc%            Return code
  4320.  
  4321.  
  4322.       Programming notes:
  4323.  
  4324.       See Appendix D for an explanation of return codes.
  4325.  
  4326.       Share% is valid only for DOS 3.XX.  DOS 2.XX users should always have
  4327.       Share% = 0.
  4328.  
  4329.       This service will open a file with normal, system, or hidden attribute.
  4330.  
  4331.       Handle% is an integer that DOS uses to identify the file.  Most of the
  4332.       other services in this section of the manual require that Handle% be
  4333.       passed to then.
  4334.  
  4335.       After an open is successfully completed, the current record pointer is set
  4336.       at the start of the file.
  4337.  
  4338.  
  4339.  
  4340.  
  4341.  
  4342.  
  4343.  
  4344.  
  4345.  
  4346.  
  4347.  
  4348.  
  4349.  
  4350.  
  4351.                        Copyright (c) 1987, AJM Software 
  4352.                                    -Page 65-
  4353.  
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360.  
  4361.  
  4362.  
  4363.  
  4364.  
  4365.       FLCLOS   - Close a file
  4366.  
  4367.       Usage - Call FlClos(Handle%, Rc%)
  4368.  
  4369.          Handle%        Handle of the file being closed.
  4370.  
  4371.          Rc%            Return code
  4372.  
  4373.  
  4374.       Programming notes:
  4375.  
  4376.       See Appendix D for an explanation of return codes.
  4377.  
  4378.       Handle% is the token returned by FLOPEN. Any file opened with FLOPEN must
  4379.       be closed with FLCLOS.
  4380.  
  4381.       Initializing Handle% improperly may have some unpredictable results, such
  4382.       as locking the keyboard or disabling the printer and/or monitor.
  4383.  
  4384.  
  4385.  
  4386.  
  4387.  
  4388.  
  4389.  
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.  
  4399.  
  4400.  
  4401.  
  4402.  
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.                        Copyright (c) 1987, AJM Software 
  4418.                                    -Page 66-
  4419.  
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426.  
  4427.  
  4428.  
  4429.  
  4430.  
  4431.  
  4432.       FLREAD   - Read a record from a file
  4433.  
  4434.       Usage - Call FlRead(Handle%, Databuf$, Buflen%, Rc%)
  4435.  
  4436.          Handle%        Handle of the file being read.
  4437.  
  4438.          Databuf$       Data area where the record will be placed after success-
  4439.                         ful completion of the read.
  4440.  
  4441.          Buflen%        Number of bytes to read.  FLREAD will return the actual
  4442.                         number of bytes read.
  4443.  
  4444.          Rc%            Return code
  4445.  
  4446.  
  4447.       Programming notes:
  4448.  
  4449.       See Appendix D for an explanation of return codes.
  4450.  
  4451.       FLREAD returns the record being pointed to by the current record pointer.
  4452.  
  4453.       After a successful read, FLREAD will update the current record to point to
  4454.       the next record in the file.
  4455.  
  4456.       Initialize Buflen% to the number of bytes that you would like to read.
  4457.       FLREAD will update this field with the actual number of bytes read.  When
  4458.       Buflen% is zero, or when it is less than it's initial value, end-of-file
  4459.       has been reached.
  4460.  
  4461.       It is the programmer's responsibility to insure that Databuf% is long
  4462.       enough to accommodate the record read from disk.  If it is not initialized
  4463.       properly, a 'String Space Corrupt' error will probably occur.  The follow-
  4464.       ing section of code shows a method of initializing Databuf$.
  4465.  
  4466.               Buflen%  = 512                    'Number of bytes to read
  4467.               Databuf$ = Space$(Buflen%)        'Create an adequate buffer
  4468.  
  4469.  
  4470.  
  4471.  
  4472.  
  4473.  
  4474.  
  4475.  
  4476.  
  4477.  
  4478.  
  4479.  
  4480.  
  4481.  
  4482.  
  4483.                        Copyright (c) 1987, AJM Software 
  4484.                                    -Page 67-
  4485.  
  4486.  
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492.  
  4493.  
  4494.  
  4495.  
  4496.  
  4497.  
  4498.       FLWRIT   - Write a record to a file
  4499.  
  4500.       Usage - Call FlWrit(Handle%, Databuf$, Buflen%, Rc%)
  4501.  
  4502.          Handle%        Handle of the file being written to.
  4503.  
  4504.          Databuf$       Data area containing the record to be written.
  4505.  
  4506.          Buflen%        Number of bytes to write.
  4507.  
  4508.          Rc%            Return code
  4509.  
  4510.  
  4511.       Programming notes:
  4512.  
  4513.       See Appendix D for an explanation of return codes.
  4514.  
  4515.       FLWRIT writes the record at the position pointed to by the current record
  4516.       pointer.
  4517.  
  4518.       After a successful write, FLWRIT will update the current record to point
  4519.       the next record in the file.
  4520.  
  4521.       Initialize Buflen% to the number of bytes that you would like to write.
  4522.       FLWRIT will update this field with the actual number of bytes written.
  4523.       When Buflen% is zero, or when it is less than it's initial value,
  4524.       a disk full condition has been reached.
  4525.  
  4526.  
  4527.  
  4528.  
  4529.  
  4530.  
  4531.  
  4532.  
  4533.  
  4534.  
  4535.  
  4536.  
  4537.  
  4538.  
  4539.  
  4540.  
  4541.  
  4542.  
  4543.  
  4544.  
  4545.  
  4546.  
  4547.  
  4548.  
  4549.                        Copyright (c) 1987, AJM Software 
  4550.                                    -Page 68-
  4551.  
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558.  
  4559.  
  4560.  
  4561.  
  4562.  
  4563.  
  4564.       FLPOINT  - Point to a specific record in a file
  4565.  
  4566.       Usage - Call FlPoint(Handle%, Recno%, Reclen%, Rc%)
  4567.  
  4568.          Handle%        Handle of the file being operated on.
  4569.  
  4570.          Recno%         Record number that you would like to point to (relative
  4571.                         to the beginning of the file).
  4572.  
  4573.          Reclen%        Length of a logical record.
  4574.  
  4575.          Rc%            Return code
  4576.  
  4577.  
  4578.       Programming notes:
  4579.  
  4580.       See Appendix D for an explanation of return codes.
  4581.  
  4582.       DOS will use Recno% and Reclen% to compute the offset of the record within
  4583.       the file.  This service updates the current record pointer.
  4584.  
  4585.       Specifying Recno% = 0 will position you at the beginning of the file.
  4586.  
  4587.       Specifying Recno% = -1 will position you at the end of the file (Useful
  4588.       for adding records to the end of a file).
  4589.  
  4590.       DOS does not perform boundary checks on this function, so specifying
  4591.       Recno% or Reclen% improperly may set the current record pointer outside
  4592.       the limits of the file.
  4593.  
  4594.  
  4595.  
  4596.  
  4597.  
  4598.  
  4599.  
  4600.  
  4601.  
  4602.  
  4603.  
  4604.  
  4605.  
  4606.  
  4607.  
  4608.  
  4609.  
  4610.  
  4611.  
  4612.  
  4613.  
  4614.  
  4615.                        Copyright (c) 1987, AJM Software 
  4616.                                    -Page 69-
  4617.  
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.  
  4624.  
  4625.  
  4626.  
  4627.  
  4628.  
  4629.  
  4630.       FLCREAT  - Create a file
  4631.  
  4632.       Usage Call FlCreat(FlSpec$, Mode%, Attr%,, Handle%, Rc%)
  4633.  
  4634.          FlSpec$        Valid ASCIIZ filename (except for Mode% = 2)
  4635.  
  4636.          Mode%          Indicates open actions:
  4637.                         0 = Create the file if it doesn't exist - if it does
  4638.                             exist, truncate the file.
  4639.                         1 = Create the file if it doesn't exist - if it does
  4640.                             exist this service will fail
  4641.                         2 = Create a temporary file with a unique file name
  4642.  
  4643.          Handle%        Handle assigned by DOS to the file
  4644.  
  4645.          Attr%          File attributes assigned to this file.
  4646.  
  4647.          Rc%            Return code
  4648.  
  4649.  
  4650.       Programming notes:
  4651.  
  4652.       See Appendix D for an explanation of return codes.
  4653.  
  4654.       See the documentation on FLATTR for an explanation of what to put in
  4655.       Attr%
  4656.  
  4657.       When Mode% is 2 Dos will create a temporary file and the name of the file
  4658.       will be returned in FlSpec$.  These files are not automatically deleted
  4659.       when the program terminates.  That is the responsibility of the program-
  4660.       mer.
  4661.  
  4662.       When a file is created, it is automatically opened for read/write access.
  4663.       No subsequent open is required to access the file, but you must close the
  4664.       file before the program terminates.
  4665.  
  4666.       When Mode% is 2 FlSpec$ must be initialized properly prior to calling
  4667.       FLCREAT.  It should consist of an ASCIIZ path name followed by 12 blanks.
  4668.       For example:
  4669.               FlSpec$ = Chr$(0) + Space$(12)    'Current directory
  4670.               FlSpec$ = "C:\" + Chr$(0) + Space$(12)  'Root directory
  4671.               FlSpec$ = "\TEMP" + Chr$(0) +Space$(12) '\TEMP directory
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.  
  4680.  
  4681.                        Copyright (c) 1987, AJM Software 
  4682.                                    -Page 70-
  4683.  
  4684.  
  4685.  
  4686.  
  4687.  
  4688.  
  4689.  
  4690.  
  4691.  
  4692.  
  4693.  
  4694.  
  4695.  
  4696.       FLDELETE - Delete a file
  4697.  
  4698.       Usage FlDelete(FlSpec$, Rc%)
  4699.  
  4700.          Flspec$        Valid ASCIIZ filename
  4701.  
  4702.          Rc%            Return code
  4703.  
  4704.  
  4705.       Programming notes:
  4706.  
  4707.       See Appendix D for an explanation of return codes.
  4708.  
  4709.       FlSpec$ may not use wildcard characters.
  4710.  
  4711.       This service should be used to delete files created using Mode% = 2 with
  4712.       FLCREAT (close it first before deleting it).
  4713.  
  4714.  
  4715.  
  4716.  
  4717.  
  4718.  
  4719.  
  4720.  
  4721.  
  4722.  
  4723.  
  4724.  
  4725.  
  4726.  
  4727.  
  4728.  
  4729.  
  4730.  
  4731.  
  4732.  
  4733.  
  4734.  
  4735.  
  4736.  
  4737.  
  4738.  
  4739.  
  4740.  
  4741.  
  4742.  
  4743.  
  4744.  
  4745.  
  4746.  
  4747.                        Copyright (c) 1987, AJM Software 
  4748.                                    -Page 71-
  4749.  
  4750.  
  4751.  
  4752.  
  4753.  
  4754.  
  4755.  
  4756.  
  4757.  
  4758.  
  4759.  
  4760.  
  4761.       FLRSECT  - Read a sector
  4762.  
  4763.       Usage - Call FlRSect(Numsect%, Databuf$, Sector%, Rc%)
  4764.  
  4765.          Numsect%       Number of sectors to read
  4766.  
  4767.          Databuf$       Data area where the data will be placed after successful
  4768.                         completion of the read.
  4769.  
  4770.          Sector%        Sector where read operation will start
  4771.  
  4772.          Rc%            Return code
  4773.  
  4774.  
  4775.       Programming notes:
  4776.  
  4777.       Databuf$ must be long enough to hold the data read by this service.  If it
  4778.       is not, you will probably get a 'String Space Corrupt' error.  Sectors are
  4779.       generally 512 bytes.  You can find out by using FLDSTAT - explained later
  4780.       in the manual.
  4781.  
  4782.       Sector% is the relative sector from the beginning of the disk, starting
  4783.       with sector 0.
  4784.  
  4785.       A return code of 0 indicates successful completion.  There are a large
  4786.       number of return codes that can indicate failure.  These will not be docu-
  4787.       mented here - if you really need them, write and we will gladly send them
  4788.       to you.
  4789.  
  4790.       If you are reading more than one sector, the sectors will be retrieved
  4791.       sequentially starting at Sector%.  e.g. if Sector% = 5 and Numsect% = 3,
  4792.       then this service will read sectors 5,6,an 7.
  4793.  
  4794.  
  4795.  
  4796.  
  4797.  
  4798.  
  4799.  
  4800.  
  4801.  
  4802.  
  4803.  
  4804.  
  4805.  
  4806.  
  4807.  
  4808.  
  4809.  
  4810.  
  4811.  
  4812.  
  4813.                        Copyright (c) 1987, AJM Software 
  4814.                                    -Page 72-
  4815.  
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822.  
  4823.  
  4824.  
  4825.  
  4826.  
  4827.  
  4828.       FLWSECT  - Write a sector
  4829.  
  4830.       Usage - Call FlWSect(Numsect%, Databuf$, Sector%, Rc%)
  4831.  
  4832.          Numsect%       Number of sectors to written
  4833.  
  4834.          Databuf$       Data area containing the data to be written.
  4835.  
  4836.          Sector%        Sector where write operation will start
  4837.  
  4838.          Rc%            Return code
  4839.  
  4840.  
  4841.       Programming notes:
  4842.  
  4843.       Sector% is the relative sector from the beginning of the disk, starting
  4844.       with sector 0.
  4845.  
  4846.       A return code of 0 indicates successful completion.  There are a large
  4847.       number of return codes that can indicate failure.  These will not be docu-
  4848.       mented here - if you really need them, write and we will gladly send them
  4849.       to you.
  4850.  
  4851.       If you are writing more than one sector, the sectors will be written
  4852.       sequentially starting at Sector%.  e.g. if Sector% = 5 and Numsect% = 3,
  4853.       then this service will write sectors 5,6,an 7.
  4854.  
  4855.       ************************** IMPORTANT ***********************************
  4856.  
  4857.       Indiscriminate use of this function can cause serious problems with youR
  4858.       disk.  Accidentally writing over the boot sector or the FAT (See the dis-
  4859.       cussion on disks in QBWARE.DOC Appendix C - found in QBWARE.ARC) can
  4860.       destroy all of the data on your disk.  TAKE A BACKUP before testing this
  4861.       service, especially if you a writing to a HARD DISK.
  4862.  
  4863.  
  4864.  
  4865.  
  4866.  
  4867.  
  4868.  
  4869.  
  4870.  
  4871.  
  4872.  
  4873.  
  4874.  
  4875.  
  4876.  
  4877.  
  4878.  
  4879.                        Copyright (c) 1987, AJM Software 
  4880.                                    -Page 73-
  4881.  
  4882.  
  4883.  
  4884.  
  4885.  
  4886.  
  4887.  
  4888.  
  4889.  
  4890.  
  4891.  
  4892.  
  4893.  
  4894.                                DOS Replacement Services
  4895.  
  4896.  
  4897.       Function Summary
  4898.  
  4899.  
  4900.       FLFIND   - Find a file or group of files
  4901.  
  4902.       FLCNT    - Count the number of matching files
  4903.  
  4904.       FLMOVE   - Move a file
  4905.  
  4906.       FLCOPY   - Copy a file to another file
  4907.  
  4908.       FLSDRV   - Set the current drive
  4909.  
  4910.       FLGDRV   - Get the current drive
  4911.  
  4912.       FLCDIR   - Change the current directory
  4913.  
  4914.       FLGDIR   - Get the current directory
  4915.  
  4916.       FLMDIR   - Make a directory
  4917.  
  4918.       FLDDIR   - Delete a directory
  4919.  
  4920.       FLDSTAT  - Retrieve disk statistics
  4921.  
  4922.  
  4923.  
  4924.  
  4925.  
  4926.  
  4927.  
  4928.  
  4929.  
  4930.  
  4931.  
  4932.  
  4933.  
  4934.  
  4935.  
  4936.  
  4937.  
  4938.  
  4939.  
  4940.  
  4941.  
  4942.  
  4943.  
  4944.  
  4945.                        Copyright (c) 1987, AJM Software 
  4946.                                    -Page 74-
  4947.  
  4948.  
  4949.  
  4950.  
  4951.  
  4952.  
  4953.  
  4954.  
  4955.  
  4956.  
  4957.  
  4958.  
  4959.       FLFIND   - Find a file or group of files
  4960.  
  4961.       Usage - Call FlFind(FlSpec$, Dirlist$(0))
  4962.  
  4963.          FlSpec$        Standard ASCIIZ filename
  4964.  
  4965.          Dirlist$(0)    Array containing all files matched by FlSpec$
  4966.  
  4967.  
  4968.       Programming notes:
  4969.  
  4970.       FLFIND will return a list of all files in the current directory that match
  4971.       FlSpec$.  Wildcards can be used.
  4972.  
  4973.       Each entry in Dirlist$ must be initialized to 40 blanks.  If each element
  4974.       is not properly initialized, a 'String Space Corrupt' error may occur.
  4975.  
  4976.       Dirlist$ must be properly dimensioned so that all files matching FlSpec$
  4977.       can fit into the array.  If it is not properly dimensioned, unpredictable
  4978.       results can occur (probably 'String Space Corrupt', but anything can hap-
  4979.       pen).  Use FLCNT to properly dimension the array.
  4980.  
  4981.       FLFIND can be used to determine the presence or absence of a file.
  4982.  
  4983.       See LOOK.BAS in the sample programs (registered users only) for an example
  4984.       of using FLCNT and FLFIND.  This program will search an entire disk look-
  4985.       ing for matches (Wildcards are okay to use with LOOK.BAS).
  4986.  
  4987.       Each element of dirlist will have several items related to the matched
  4988.       files in it.  The following program segment illustrates the proper use of
  4989.       FLFIND.
  4990.  
  4991.  
  4992.          FlSpec$ = "*.*"+chr$(0)         'Complete file directory
  4993.  
  4994.          call flcnt(FlSpec$, Count%)     'Get a count of matching files
  4995.  
  4996.          Dim Dirlist$(Count%-1)          'Dimension the array to FLFIND
  4997.                                          'Subtract 1 for Option Base 0
  4998.  
  4999.  
  5000.          For x%=0 to ubound(Dirlist$)    'Initialize each element of array
  5001.               Dirlist$(x%) = space$(40)       'to 40 blanks
  5002.          Next
  5003.  
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.                        Copyright (c) 1987, AJM Software 
  5012.                                    -Page 75-
  5013.  
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020.  
  5021.  
  5022.  
  5023.  
  5024.  
  5025.  
  5026.          Call FlFind(FlSpec$, Dirlist$(0))
  5027.  
  5028.       '   Each element of the array will be broken down into components
  5029.       '   The layout of each item is:
  5030.  
  5031.       '       Pos.    Description
  5032.  
  5033.       '       1-5     File Attributes
  5034.       '       6-13    File creation time (HH:MM:SS)
  5035.       '       14-23   File creation date (MM-DD-YYYY)
  5036.       '       24-25   Low order file size
  5037.       '       26-27   High order file size
  5038.       '       28-39   File name
  5039.  
  5040.          For x% = 0 to Ubound(Dirlist$)
  5041.               if Dirlist$(x%) <> space$(50) then
  5042.                   xfname$ = mid$(Dirlist$(x%),28,12)
  5043.                   fattr$  = mid$(Dirlist$(x%),1,5)
  5044.                   ftime$  = mid$(Dirlist$(x%),6,8)
  5045.                   fdate$  = mid$(Dirlist$(x%),14,10)
  5046.                   fsize1# = cvi(mid$(Dirlist$(x%),26,2))*65536
  5047.                   fsize2# = cvi(mid$(Dirlist$(x%),24,2))
  5048.                   if fsize2# < 0 then
  5049.                       fsize2# = 65536 + fsize2#
  5050.                   end if
  5051.                   fsize#  = fsize1# + fsize2#
  5052.                   cls
  5053.                   locate 1,1
  5054.                   print xfname$
  5055.                   print fattr$, "Attributes"
  5056.                   print fdate$, "Creation date"
  5057.                   print ftime$, "Creation time"
  5058.                   print fsize#, "File size"
  5059.                   locate 23,1
  5060.                   print "Press any key to continue"
  5061.                   x$ = ""
  5062.                   while x$ = ""
  5063.                       x$ = inkey$
  5064.                   wend
  5065.               end if
  5066.          next
  5067.  
  5068.  
  5069.  
  5070.  
  5071.  
  5072.  
  5073.  
  5074.  
  5075.  
  5076.  
  5077.                        Copyright (c) 1987, AJM Software 
  5078.                                    -Page 76-
  5079.  
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086.  
  5087.  
  5088.  
  5089.  
  5090.  
  5091.  
  5092.       FLCNT    - Count the number of matching files
  5093.  
  5094.       Usage - Call(FlCnt(FlSpec$, Count%)
  5095.  
  5096.          FlSpec$        Standard ASCIIZ filename
  5097.  
  5098.          Count%         Number of files matching FlSpec$
  5099.  
  5100.  
  5101.       Programming notes:
  5102.  
  5103.       FLCNT will return a count of all files in the current directory that match
  5104.       FlSpec$.  Wildcards can be used.
  5105.  
  5106.       FLCNT can be used to determine the presence or absence of file.
  5107.  
  5108.       FLCNT should be used prior to calling FLFIND to ensure that the passed
  5109.       array is large enough.
  5110.  
  5111.       See LOOK.BAS in the sample programs (registered users only) for an example
  5112.       of using FLCNT and FLFIND.  This program will search an entire disk look-
  5113.       ing for matches (Wildcards are okay to use with LOOK.BAS).
  5114.  
  5115.  
  5116.  
  5117.  
  5118.  
  5119.  
  5120.  
  5121.  
  5122.  
  5123.  
  5124.  
  5125.  
  5126.  
  5127.  
  5128.  
  5129.  
  5130.  
  5131.  
  5132.  
  5133.  
  5134.  
  5135.  
  5136.  
  5137.  
  5138.  
  5139.  
  5140.  
  5141.  
  5142.  
  5143.                        Copyright (c) 1987, AJM Software 
  5144.                                    -Page 77-
  5145.  
  5146.  
  5147.  
  5148.  
  5149.  
  5150.  
  5151.  
  5152.  
  5153.  
  5154.  
  5155.  
  5156.  
  5157.  
  5158.       FLMOVE   - Move a file
  5159.  
  5160.       Usage - Call FlMove(Old.FlSpec$, New.FlSpec$, Rc%)
  5161.  
  5162.          Old.FlSpec$    Standard ASCIIZ filename
  5163.  
  5164.          New.FlSpec$    Standard ASCIIZ filename
  5165.  
  5166.          Rc%            Return code
  5167.  
  5168.  
  5169.       Programming notes:
  5170.  
  5171.       New.FlSpec$ can be any valid DOS filename that is not currently in use.
  5172.       You may specify a different directory, but you cannot move a file to a
  5173.       different device.
  5174.  
  5175.       Wildcards are not allowed. (A DOS wildcard is an '*' or a '?')
  5176.  
  5177.       See Appendix D for an explanation of return codes.
  5178.  
  5179.  
  5180.  
  5181.  
  5182.  
  5183.  
  5184.  
  5185.  
  5186.  
  5187.  
  5188.  
  5189.  
  5190.  
  5191.  
  5192.  
  5193.  
  5194.  
  5195.  
  5196.  
  5197.  
  5198.  
  5199.  
  5200.  
  5201.  
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.  
  5209.                        Copyright (c) 1987, AJM Software 
  5210.                                    -Page 78-
  5211.  
  5212.  
  5213.  
  5214.  
  5215.  
  5216.  
  5217.  
  5218.  
  5219.  
  5220.  
  5221.  
  5222.  
  5223.       FLCOPY   - Copy a file to another file
  5224.  
  5225.       Usage - Call FlCopy(Old.Flspec$, New.Flspec$, Rc%)
  5226.  
  5227.          Old.FlSpec$    Standard ASCIIZ filename
  5228.  
  5229.          New.FlSpec$    Standard ASCIIZ filename
  5230.  
  5231.          Rc%            Return code
  5232.  
  5233.  
  5234.       Programming notes:
  5235.  
  5236.       New.FlSpec$ must be a valid DOS filename.  If it already exists, it will
  5237.       be overwritten.
  5238.  
  5239.       This function is somewhat slower than the DOS copy command.  If a faster
  5240.       copy is needed, modify the Assembly source code to provide a larger buf-
  5241.       fer (registered users only).
  5242.  
  5243.       See Appendix D for an explanation of return codes.
  5244.  
  5245.  
  5246.  
  5247.  
  5248.  
  5249.  
  5250.  
  5251.  
  5252.  
  5253.  
  5254.  
  5255.  
  5256.  
  5257.  
  5258.  
  5259.  
  5260.  
  5261.  
  5262.  
  5263.  
  5264.  
  5265.  
  5266.  
  5267.  
  5268.  
  5269.  
  5270.  
  5271.  
  5272.  
  5273.  
  5274.  
  5275.                        Copyright (c) 1987, AJM Software 
  5276.                                    -Page 79-
  5277.  
  5278.  
  5279.  
  5280.  
  5281.  
  5282.  
  5283.  
  5284.  
  5285.  
  5286.  
  5287.  
  5288.  
  5289.       FLSDRV   - Set the current drive
  5290.  
  5291.       Usage - Call FlSDrv(Drive$)
  5292.  
  5293.          Drive$         Drive letter designation
  5294.  
  5295.  
  5296.       Programming notes:
  5297.  
  5298.       This service does not return a completion code.  It is up to the program-
  5299.       mer to insure that Drive$ is a valid drive designation (See FlGDrv to
  5300.       determine the number of drives).
  5301.  
  5302.  
  5303.  
  5304.  
  5305.  
  5306.  
  5307.  
  5308.  
  5309.  
  5310.  
  5311.  
  5312.  
  5313.  
  5314.  
  5315.  
  5316.  
  5317.  
  5318.  
  5319.  
  5320.  
  5321.  
  5322.  
  5323.  
  5324.  
  5325.  
  5326.  
  5327.  
  5328.  
  5329.  
  5330.  
  5331.  
  5332.  
  5333.  
  5334.  
  5335.  
  5336.  
  5337.  
  5338.  
  5339.  
  5340.  
  5341.                        Copyright (c) 1987, AJM Software 
  5342.                                    -Page 80-
  5343.  
  5344.  
  5345.  
  5346.  
  5347.  
  5348.  
  5349.  
  5350.  
  5351.  
  5352.  
  5353.  
  5354.  
  5355.       FLGDRV   - Get the current drive
  5356.  
  5357.       Usage - Call FlGDrv(Drive$, Max.Drive$)
  5358.  
  5359.          Drive$         Drive letter designation
  5360.  
  5361.          Max.Drive$     Letter of the highest drive designation that Dos will
  5362.                         recognize.
  5363.  
  5364.  
  5365.       Programming notes:
  5366.  
  5367.       Drive$ must be initialized to a single blank.  If it is not properly ini-
  5368.       tialized, this service will not function and a 'String Space Corrupt'
  5369.       error may occur.
  5370.  
  5371.       Max.Drive$ is the highest letter designation that DOS will recognize. DOS
  5372.       assigns drive designators sequentially, so generally, if Max.Drive$ = 'D',
  5373.       that should mean that drives A,B, and C are valid.
  5374.  
  5375.       On some machines, Max.Drive$ may not be a valid drive.  It may be the
  5376.       drive specified by the LASTDRIVE parameter of your CONFIG.SYS file.  For
  5377.       consistent accurate results with this function, properly set LASTDRIVE in
  5378.       your CONFIG.SYS file.
  5379.  
  5380.  
  5381.  
  5382.  
  5383.  
  5384.  
  5385.  
  5386.  
  5387.  
  5388.  
  5389.  
  5390.  
  5391.  
  5392.  
  5393.  
  5394.  
  5395.  
  5396.  
  5397.  
  5398.  
  5399.  
  5400.  
  5401.  
  5402.  
  5403.  
  5404.  
  5405.  
  5406.  
  5407.                        Copyright (c) 1987, AJM Software 
  5408.                                    -Page 81-
  5409.  
  5410.  
  5411.  
  5412.  
  5413.  
  5414.  
  5415.  
  5416.  
  5417.  
  5418.  
  5419.  
  5420.  
  5421.  
  5422.       FLCDIR   - Change the current directory
  5423.  
  5424.       Usage - Call FlCDir(Dir$, Rc%)
  5425.  
  5426.          Dir$           Valid directory name (ASCIIZ string)
  5427.  
  5428.          Rc%            Return code
  5429.  
  5430.  
  5431.       Programming notes:
  5432.  
  5433.       See Appendix A for an explanation of return codes.
  5434.  
  5435.       Dir$ must be a valid directory name preceded by a '\' and followed by
  5436.       a Chr$(0)
  5437.  
  5438.  
  5439.  
  5440.  
  5441.  
  5442.  
  5443.  
  5444.  
  5445.  
  5446.  
  5447.  
  5448.  
  5449.  
  5450.  
  5451.  
  5452.  
  5453.  
  5454.  
  5455.  
  5456.  
  5457.  
  5458.  
  5459.  
  5460.  
  5461.  
  5462.  
  5463.  
  5464.  
  5465.  
  5466.  
  5467.  
  5468.  
  5469.  
  5470.  
  5471.  
  5472.  
  5473.                        Copyright (c) 1987, AJM Software 
  5474.                                    -Page 82-
  5475.  
  5476.  
  5477.  
  5478.  
  5479.  
  5480.  
  5481.  
  5482.  
  5483.  
  5484.  
  5485.  
  5486.       FLGDIR   - Get the current directory
  5487.  
  5488.       Usage - Call FlGDir(Dir$)
  5489.  
  5490.          Dir$           Valid directory name (ASCIIZ string)
  5491.  
  5492.  
  5493.       Programming notes:
  5494.  
  5495.       Dir$ must be initialized to 64 blanks prior to calling FLGDIR.  If it is
  5496.       not initialized properly, a 'String Space Corrupt' may result.  
  5497.  
  5498.       The current directory is returned in Dir$.  It is not preceded by a '\'.
  5499.  
  5500.  
  5501.  
  5502.  
  5503.  
  5504.  
  5505.  
  5506.  
  5507.  
  5508.  
  5509.  
  5510.  
  5511.  
  5512.  
  5513.  
  5514.  
  5515.  
  5516.  
  5517.  
  5518.  
  5519.  
  5520.  
  5521.  
  5522.  
  5523.  
  5524.  
  5525.  
  5526.  
  5527.  
  5528.  
  5529.  
  5530.  
  5531.  
  5532.  
  5533.  
  5534.  
  5535.  
  5536.  
  5537.  
  5538.  
  5539.                        Copyright (c) 1987, AJM Software 
  5540.                                    -Page 83-
  5541.  
  5542.  
  5543.  
  5544.  
  5545.  
  5546.  
  5547.  
  5548.  
  5549.  
  5550.  
  5551.  
  5552.  
  5553.       FLMDIR   - Make a directory
  5554.  
  5555.       Usage - Call FlMDir(Dir$, Rc%)
  5556.  
  5557.          Dir$           Valid directory name (ASCIIZ string)
  5558.  
  5559.          Rc%            Return code
  5560.  
  5561.  
  5562.       Programming notes:
  5563.  
  5564.       See Appendix D for an explanation of return codes.
  5565.  
  5566.       Dir$ must be a valid directory name preceded by a '\' and followed by
  5567.       a Chr$(0)
  5568.  
  5569.  
  5570.  
  5571.  
  5572.  
  5573.  
  5574.  
  5575.  
  5576.  
  5577.  
  5578.  
  5579.  
  5580.  
  5581.  
  5582.  
  5583.  
  5584.  
  5585.  
  5586.  
  5587.  
  5588.  
  5589.  
  5590.  
  5591.  
  5592.  
  5593.  
  5594.  
  5595.  
  5596.  
  5597.  
  5598.  
  5599.  
  5600.  
  5601.  
  5602.  
  5603.  
  5604.  
  5605.                        Copyright (c) 1987, AJM Software 
  5606.                                    -Page 84-
  5607.  
  5608.  
  5609.  
  5610.  
  5611.  
  5612.  
  5613.  
  5614.  
  5615.  
  5616.  
  5617.       FLDDIR   - Delete a directory
  5618.  
  5619.       Usage - Call FlDDir(Dir$, Rc%)
  5620.  
  5621.          Dir$           Valid directory name (ASCIIZ string)
  5622.  
  5623.          Rc%            Return code
  5624.  
  5625.  
  5626.       Programming notes:
  5627.  
  5628.       See Appendix D for an explanation of return codes.
  5629.  
  5630.       Dir$ must be a valid directory name preceded by a '\' and followed by
  5631.       a Chr$(0)
  5632.  
  5633.  
  5634.  
  5635.  
  5636.  
  5637.  
  5638.  
  5639.  
  5640.  
  5641.  
  5642.  
  5643.  
  5644.  
  5645.  
  5646.  
  5647.  
  5648.  
  5649.  
  5650.  
  5651.  
  5652.  
  5653.  
  5654.  
  5655.  
  5656.  
  5657.  
  5658.  
  5659.  
  5660.  
  5661.  
  5662.  
  5663.  
  5664.  
  5665.  
  5666.  
  5667.  
  5668.  
  5669.  
  5670.  
  5671.                        Copyright (c) 1987, AJM Software 
  5672.                                    -Page 85-
  5673.  
  5674.  
  5675.  
  5676.  
  5677.  
  5678.  
  5679.  
  5680.  
  5681.  
  5682.  
  5683.  
  5684.  
  5685.       FLDSTAT  - Retrieve disk statistics
  5686.  
  5687.       Usage - Call FlDStat(Drive$, Type%, Bytes.Sector%, Sector.Cluster%, _
  5688.                            Avail.Cluster%, Total.Cluster%, Rc%)
  5689.  
  5690.          Drive$           Valid letter drive designation
  5691.  
  5692.          Type%            Type of drive
  5693.  
  5694.          Bytes.Sector%    Number of bytes in a sector on the target disk
  5695.  
  5696.          Sector.Cluster%  Number of sectors in a cluster on the target disk
  5697.  
  5698.          Avail.Cluster%   Number of unused clusters on the target drive
  5699.  
  5700.          Total.Cluster%   Number of clusters on the target drive
  5701.  
  5702.          Rc%              Return code
  5703.  
  5704.  
  5705.       Programming notes:
  5706.  
  5707.       See Appendix D for an explanation of return codes.
  5708.  
  5709.       Type% will indicate the type of drive.  Possible values are:
  5710.  
  5711.          255  -  DSDD   8 Sectors/Track
  5712.          254  -  SSDD   8 Sectors/Track
  5713.          253  -  DSDD   9 Sectors/Track
  5714.          252  -  SSDD   8 Sectors/Track
  5715.          249  -  HD    15 Sectors/Track
  5716.          248  -  Fixed disk
  5717.  
  5718.       Most RAM drives will appear to be a fixed disk.
  5719.  
  5720.       Available space on the disk can be computed by the formula:
  5721.          Bytes.Sector% * Sector.Cluster% * Avail.Cluster%
  5722.  
  5723.       Total space on the disk can be computed by the formula:
  5724.          Bytes.Sector% * Sector.Cluster% * Total.Cluster%
  5725.  
  5726.  
  5727.  
  5728.  
  5729.  
  5730.  
  5731.  
  5732.  
  5733.  
  5734.  
  5735.  
  5736.  
  5737.                        Copyright (c) 1987, AJM Software 
  5738.                                    -Page 86-
  5739.  
  5740.  
  5741.  
  5742.  
  5743.  
  5744.  
  5745.  
  5746.  
  5747.  
  5748.  
  5749.  
  5750.  
  5751.                              Miscellaneous DOS Services
  5752.  
  5753.  
  5754.       Function Summary
  5755.  
  5756.  
  5757.       BOOT     - Initiate a cold or warm boot
  5758.  
  5759.       DOSCHOUT - Write a string to the standard output device
  5760.  
  5761.       DOSCHRIN - Read a character from the standard input device
  5762.  
  5763.       DOSSTRIN - Read a string from the standard input device
  5764.  
  5765.       DOSRED   - Redirect a DOS standard handle
  5766.  
  5767.       DOSPRSC  - Print the screen
  5768.  
  5769.       DOSVER   - Get the DOS version
  5770.  
  5771.       DOSVRFY  - Turn verify mode on and off
  5772.  
  5773.  
  5774.  
  5775.  
  5776.  
  5777.  
  5778.  
  5779.  
  5780.  
  5781.  
  5782.  
  5783.  
  5784.  
  5785.  
  5786.  
  5787.  
  5788.  
  5789.  
  5790.  
  5791.  
  5792.  
  5793.  
  5794.  
  5795.  
  5796.  
  5797.  
  5798.  
  5799.  
  5800.  
  5801.  
  5802.  
  5803.                        Copyright (c) 1987, AJM Software 
  5804.                                    -Page 87-
  5805.  
  5806.  
  5807.  
  5808.  
  5809.  
  5810.  
  5811.  
  5812.  
  5813.  
  5814.  
  5815.  
  5816.  
  5817.  
  5818.       BOOT    - Initiate a cold or ward boot
  5819.  
  5820.       Usage - Call Boot(Function%)
  5821.  
  5822.          Function%      0 - Perform a warm boot
  5823.                         1 - perform a cold boot
  5824.  
  5825.  
  5826.       Programming notes:
  5827.  
  5828.       There is no return from this function - it restarts the machine.
  5829.  
  5830.       A warm boot is the equivalent of pressing Alt-Ctrl-Del - a cold boot is
  5831.       the equivalent of turning the machine off and then on again.
  5832.  
  5833.  
  5834.  
  5835.  
  5836.  
  5837.  
  5838.  
  5839.  
  5840.  
  5841.  
  5842.  
  5843.  
  5844.  
  5845.  
  5846.  
  5847.  
  5848.  
  5849.  
  5850.  
  5851.  
  5852.  
  5853.  
  5854.  
  5855.  
  5856.  
  5857.  
  5858.  
  5859.  
  5860.  
  5861.  
  5862.  
  5863.  
  5864.  
  5865.  
  5866.  
  5867.  
  5868.  
  5869.                        Copyright (c) 1987, AJM Software 
  5870.                                    -Page 88-
  5871.  
  5872.  
  5873.  
  5874.  
  5875.  
  5876.  
  5877.  
  5878.  
  5879.  
  5880.  
  5881.  
  5882.  
  5883.       DOSCHOUT - Write a string to the standard output device
  5884.  
  5885.       Usage - Call DosChOut(Str.Out$)
  5886.  
  5887.          Str.Out$       Text to be written
  5888.  
  5889.  
  5890.       Programming notes:
  5891.  
  5892.       If the standard output device is CON (monitor), the text is written to the
  5893.       current cursor location.
  5894.  
  5895.       Printing control characters(i.e. carriage return, line feeds) will cause
  5896.       the cursor to move accordingly.
  5897.  
  5898.       All data is written in 'raw' mode - this bypasses certain checking that
  5899.       DOS normally would do and increases output speed a little.
  5900.  
  5901.       Do not print chr$(255) as this will cause a keyboard read to occur.
  5902.  
  5903.       This service, like the other DOS keyboard/con services, can be
  5904.       re-directed.
  5905.  
  5906.  
  5907.  
  5908.  
  5909.  
  5910.  
  5911.  
  5912.  
  5913.  
  5914.  
  5915.  
  5916.  
  5917.  
  5918.  
  5919.  
  5920.  
  5921.  
  5922.  
  5923.  
  5924.  
  5925.  
  5926.  
  5927.  
  5928.  
  5929.  
  5930.  
  5931.  
  5932.  
  5933.  
  5934.  
  5935.                        Copyright (c) 1987, AJM Software 
  5936.                                    -Page 89-
  5937.  
  5938.  
  5939.  
  5940.  
  5941.  
  5942.  
  5943.  
  5944.  
  5945.  
  5946.  
  5947.  
  5948.  
  5949.       DOSCHRIN - Read a character from the standard input device
  5950.  
  5951.       Usage - Call DosChrIn(Char.In$, Echo%, Rc%)
  5952.  
  5953.          Char.In$       Character returned from the standard input device.
  5954.  
  5955.          Echo%          0 - do not echo to standard output
  5956.                         1 - echo to standard output
  5957.  
  5958.          Rc%            0 - indicates no character was found
  5959.                         1 - indicates character returned in Char.In$
  5960.                         2 - indicates an extended ASCII character was returned
  5961.                             in Char.In$
  5962.  
  5963.  
  5964.       Programming notes:
  5965.  
  5966.       Extended ASCII characters will not echo.
  5967.  
  5968.       No special action is taken if Ctrl-C or Ctrl-Break is detected.
  5969.  
  5970.       Char.In$ must be initialized to a space.  If it is not, the service will
  5971.       fail and a "String Space Corrupt' condition may occur.
  5972.  
  5973.       If an extended ASCII code is entered, Char.In$ will contain the second
  5974.       character of the code.
  5975.  
  5976.       This service, like the other DOS keyboard/con services, can be
  5977.       re-directed.
  5978.  
  5979.  
  5980.  
  5981.  
  5982.  
  5983.  
  5984.  
  5985.  
  5986.  
  5987.  
  5988.  
  5989.  
  5990.  
  5991.  
  5992.  
  5993.  
  5994.  
  5995.  
  5996.  
  5997.  
  5998.  
  5999.  
  6000.  
  6001.                        Copyright (c) 1987, AJM Software 
  6002.                                    -Page 90-
  6003.  
  6004.  
  6005.  
  6006.  
  6007.  
  6008.  
  6009.  
  6010.  
  6011.  
  6012.  
  6013.  
  6014.  
  6015.       DOSSTRIN - Read a string from the standard input device
  6016.  
  6017.       Usage - Call DosStrIn(Text.In$, Count%)
  6018.  
  6019.          Text.In$       input string
  6020.  
  6021.          Count%         length of input string
  6022.  
  6023.  
  6024.       Programming notes:
  6025.  
  6026.       Use this function only for input of a single string on a screen.  The
  6027.       editing characteristics of this service do not lend themselves to full
  6028.       screen input.
  6029.  
  6030.       No extended ASCII codes are allowed by this function.
  6031.  
  6032.       The maximum input length is the length of Text.In$ - 3.  For example, if
  6033.       you wanted input with a maximum length of 12 characters, use the following
  6034.       code:
  6035.  
  6036.                         Text.In$ = Space$(15)  'Maximum length + 3
  6037.                         call DosStrIn(Text.In$, Count%)
  6038.  
  6039.       End of input is signaled by pressing the [Enter] key.
  6040.  
  6041.       If you type in more than the maximum number of characters, the beep will
  6042.       sound until [Enter] is pressed.
  6043.  
  6044.       No cursor will be displayed while characters are being entered.
  6045.  
  6046.       The characters entered at the keyboard will echo on the monitor at the
  6047.       current cursor position.
  6048.  
  6049.       This service, like the other DOS keyboard/con services, can be
  6050.       re-directed.
  6051.  
  6052.  
  6053.  
  6054.  
  6055.  
  6056.  
  6057.  
  6058.  
  6059.  
  6060.  
  6061.  
  6062.  
  6063.  
  6064.  
  6065.  
  6066.  
  6067.                        Copyright (c) 1987, AJM Software 
  6068.                                    -Page 91-
  6069.  
  6070.  
  6071.  
  6072.  
  6073.  
  6074.  
  6075.  
  6076.  
  6077.  
  6078.  
  6079.  
  6080.  
  6081.       DOSRED   - Redirect a DOS standard handle
  6082.  
  6083.       Usage - Call DosRed(Device%, FileSpec$, Rc%)
  6084.  
  6085.          Device%        Device to redirect
  6086.                         0 - Standard input
  6087.                         1 - Standard output
  6088.                         3 - Standard AUX device
  6089.                         4 - Standard list device
  6090.  
  6091.          Filespec$      Standard ASCIIZ string
  6092.  
  6093.          Rc%            Return code
  6094.  
  6095.  
  6096.       Programming notes:
  6097.  
  6098.       See the Appendix D for an explanation of return codes.
  6099.  
  6100.       The standard input device is CON, or the keyboard.  If you redirect this
  6101.       device to accept from a file, you cannot detect end-of-file.  If you play
  6102.       with this device, be prepared to reboot quite a bit while testing - incor-
  6103.       rect handling can easily cause the keyboard to lock up.
  6104.  
  6105.       The standard output device is CON, or the monitor.  You can redirect this
  6106.       device either to a file or printer.  Once redirected, all PRINT statements
  6107.       will print to FileSpec$.  See the sample program TYPER.BAS included with
  6108.       this package.
  6109.  
  6110.       The standard auxiliary device is AUX - generally COM1.
  6111.  
  6112.       The standard list device is PRN - generally LPT1.  Unfortunately, Basic
  6113.       does not use the standard list device for LPRINT statements or for
  6114.       PRINT# statements, thereby making redirection of this handle a little less
  6115.       useful than it could be.
  6116.  
  6117.       If FileSpec$ is NUL (i.e. FileSpec$ = ""), DOSRED will reset the device to
  6118.       its default value. these are:
  6119.  
  6120.               Device%          Default
  6121.                 0                CON
  6122.                 1                CON
  6123.                 3                AUX
  6124.                 4                PRN
  6125.  
  6126.       If FIleSpec$ is CHR$(255), DOSRED will simply close that handle.  This is
  6127.       useful if you're not using DOS 3.3 and you need more than fifteen files
  6128.       open at one time (the Quickbasic limit).  Simply close one of the devices,
  6129.       and that allows you to open another file.  If you close the standard input
  6130.  
  6131.  
  6132.  
  6133.                        Copyright (c) 1987, AJM Software 
  6134.                                    -Page 92-
  6135.  
  6136.  
  6137.  
  6138.  
  6139.  
  6140.  
  6141.  
  6142.  
  6143.  
  6144.  
  6145.  
  6146.  
  6147.       device, be sure to reopen it as you won't be able to get any input from
  6148.       the keyboard.  Rumor has it that under DOS 3.3, you can have up to 255
  6149.       files open at any one time.
  6150.  
  6151.       If FileSpec$ is a disk file, and it already exists, DOSRED will simply
  6152.       write over it.  If it does not exist, DOSRED will create it.  You must
  6153.       close any disk files used for redirection before terminating your program.
  6154.       Otherwise, the file's directory entry (length) will not be updated and you
  6155.       will not be able to process that file.  A file close is done automatically
  6156.       when you issue a reset (FileSpec$ = "").
  6157.  
  6158.  
  6159.  
  6160.  
  6161.  
  6162.  
  6163.  
  6164.  
  6165.  
  6166.  
  6167.  
  6168.  
  6169.  
  6170.  
  6171.  
  6172.  
  6173.  
  6174.  
  6175.  
  6176.  
  6177.  
  6178.  
  6179.  
  6180.  
  6181.  
  6182.  
  6183.  
  6184.  
  6185.  
  6186.  
  6187.  
  6188.  
  6189.  
  6190.  
  6191.  
  6192.  
  6193.  
  6194.  
  6195.  
  6196.  
  6197.  
  6198.  
  6199.                        Copyright (c) 1987, AJM Software 
  6200.                                    -Page 93-
  6201.  
  6202.  
  6203.  
  6204.  
  6205.  
  6206.  
  6207.  
  6208.  
  6209.  
  6210.  
  6211.  
  6212.  
  6213.       DOSPRSC  - Print the screen
  6214.  
  6215.       Call DosPrSc
  6216.  
  6217.  
  6218.       Programming notes:
  6219.  
  6220.       This service will print the contents of the screen buffer.  It is really a
  6221.       BIOS service, but because of it's usefulness, it is included here.
  6222.  
  6223.  
  6224.  
  6225.  
  6226.  
  6227.  
  6228.  
  6229.  
  6230.  
  6231.  
  6232.  
  6233.  
  6234.  
  6235.  
  6236.  
  6237.  
  6238.  
  6239.  
  6240.  
  6241.  
  6242.  
  6243.  
  6244.  
  6245.  
  6246.  
  6247.  
  6248.  
  6249.  
  6250.  
  6251.  
  6252.  
  6253.  
  6254.  
  6255.  
  6256.  
  6257.  
  6258.  
  6259.  
  6260.  
  6261.  
  6262.  
  6263.  
  6264.  
  6265.                        Copyright (c) 1987, AJM Software 
  6266.                                    -Page 94-
  6267.  
  6268.  
  6269.  
  6270.  
  6271.  
  6272.  
  6273.  
  6274.  
  6275.  
  6276.  
  6277.  
  6278.  
  6279.       DOSVER   - Get the DOS version
  6280.  
  6281.  
  6282.       Usage - Call DosVer(Version%)
  6283.  
  6284.          Version%       the version of DOS currently running
  6285.  
  6286.  
  6287.       Programming notes:
  6288.  
  6289.       Version is returned as an integer.  DOS 3.10 would be returned as 310, and
  6290.       so on.  To display it properly, use the following code:
  6291.  
  6292.  
  6293.          Call DosVer(Version%)
  6294.          Print Using "#.##";Version%/100
  6295.  
  6296.  
  6297.  
  6298.  
  6299.  
  6300.  
  6301.  
  6302.  
  6303.  
  6304.  
  6305.  
  6306.  
  6307.  
  6308.  
  6309.  
  6310.  
  6311.  
  6312.  
  6313.  
  6314.  
  6315.  
  6316.  
  6317.  
  6318.  
  6319.  
  6320.  
  6321.  
  6322.  
  6323.  
  6324.  
  6325.  
  6326.  
  6327.  
  6328.  
  6329.  
  6330.  
  6331.                        Copyright (c) 1987, AJM Software 
  6332.                                    -Page 95-
  6333.  
  6334.  
  6335.  
  6336.  
  6337.  
  6338.  
  6339.  
  6340.  
  6341.  
  6342.  
  6343.  
  6344.  
  6345.       DOSVRFY  - Turn verify mode on and off
  6346.  
  6347.       Usage - Call DosVrfy(Function%)
  6348.  
  6349.          Function%      0 - turn verify off
  6350.                         1 - turn verify on
  6351.                        -1 - get status of verify
  6352.  
  6353.  
  6354.       Programming notes:
  6355.  
  6356.       When verify is on, every write request made through DOS will cause DOS to
  6357.       reread the sector just written to insure that it is readable.
  6358.  
  6359.       No verification is done when BIOS is used to write a sector.
  6360.  
  6361.       DOS does NOT perform a verify by checking that the sector written matches
  6362.       the data in the output buffer.  It simply insures that the sector written
  6363.       can be read and that it passes the CRC.
  6364.  
  6365.       Verify does add overhead when it is turned on.  Use this service when the
  6366.       output media is questionable.
  6367.  
  6368.       When using Function% = -1, DOSVRFY will return a 0 in Function% if Verify
  6369.       is off and a 1 if Verify is on.
  6370.  
  6371.  
  6372.  
  6373.  
  6374.  
  6375.  
  6376.  
  6377.  
  6378.  
  6379.  
  6380.  
  6381.  
  6382.  
  6383.  
  6384.  
  6385.  
  6386.  
  6387.  
  6388.  
  6389.  
  6390.  
  6391.  
  6392.  
  6393.  
  6394.  
  6395.  
  6396.  
  6397.                        Copyright (c) 1987, AJM Software 
  6398.                                    -Page 96-
  6399.  
  6400.  
  6401.  
  6402.  
  6403.  
  6404.  
  6405.  
  6406.  
  6407.  
  6408.  
  6409.  
  6410.  
  6411.  
  6412.                                   The Print Spooler
  6413.  
  6414.  
  6415.                YOU MUST HAVE VERSION 3.XX OF DOS TO USE THESE SERVICES
  6416.  
  6417.  
  6418.       Function Summary
  6419.  
  6420.  
  6421.       DOSPSTAT - Request spooler status
  6422.  
  6423.       DOSPCAN  - Cancel all spooled files
  6424.  
  6425.       DOSPDEL  - Delete a file from the queue
  6426.  
  6427.       DOSPLST  - List all files in the queue
  6428.  
  6429.       DOSPSUB  - Submit a file to the queue
  6430.  
  6431.  
  6432.  
  6433.  
  6434.  
  6435.  
  6436.  
  6437.  
  6438.  
  6439.  
  6440.  
  6441.  
  6442.  
  6443.  
  6444.  
  6445.  
  6446.  
  6447.  
  6448.  
  6449.  
  6450.  
  6451.  
  6452.  
  6453.  
  6454.  
  6455.  
  6456.  
  6457.  
  6458.  
  6459.  
  6460.  
  6461.  
  6462.  
  6463.                        Copyright (c) 1987, AJM Software 
  6464.                                    -Page 97-
  6465.  
  6466.  
  6467.  
  6468.  
  6469.  
  6470.  
  6471.  
  6472.  
  6473.  
  6474.  
  6475.  
  6476.  
  6477.  
  6478.  
  6479.       DOSPSTAT - Request spooler status
  6480.  
  6481.       Usage - Call DosPStat(Rc%)
  6482.  
  6483.          Rc%            0 - Normal status - okay to use spooler
  6484.                         1 - Spooler is inactive
  6485.                         2 - Spooler unavailable
  6486.                       255 - Invalid request (invalid DOS version)
  6487.  
  6488.  
  6489.       Programming notes:
  6490.  
  6491.       This service simply provides the spooler status.  Each service in this
  6492.       section also checks the spooler status.
  6493.  
  6494.       The only good return code is 0.  Any of the other return codes indicate
  6495.       that the spooler is not useable.
  6496.  
  6497.       A return code of 1 indicates the spooler is not running, but it could
  6498.       be started from the DOS prompt.
  6499.  
  6500.       A return code of 2 indicates that the spooler is not active and it cannot
  6501.       be started because some other process has captured the spooler interrupt.
  6502.  
  6503.       A return code of 255 indicates that the wrong version of DOS is installed
  6504.       - version 3.00 or higher is needed.
  6505.  
  6506.       See Appendix E for a discussion on starting the print spooler.
  6507.  
  6508.  
  6509.  
  6510.  
  6511.  
  6512.  
  6513.  
  6514.  
  6515.  
  6516.  
  6517.  
  6518.  
  6519.  
  6520.  
  6521.  
  6522.  
  6523.  
  6524.  
  6525.  
  6526.  
  6527.  
  6528.  
  6529.                        Copyright (c) 1987, AJM Software 
  6530.                                    -Page 98-
  6531.  
  6532.  
  6533.  
  6534.  
  6535.  
  6536.  
  6537.  
  6538.  
  6539.  
  6540.  
  6541.  
  6542.  
  6543.  
  6544.       DOSPCAN  - Cancel all spooled files
  6545.  
  6546.       Usage - Call DosPCan(Rc%)
  6547.  
  6548.          Rc%            Return code
  6549.  
  6550.  
  6551.       Programming notes:
  6552.  
  6553.       See Appendix E for an explanation of return codes.
  6554.  
  6555.       This service will delete all files from the print queue.  Please remember
  6556.       that most printers have a print buffer - some as large as 256k.  This
  6557.       function will not clear the print buffer.
  6558.  
  6559.  
  6560.  
  6561.  
  6562.  
  6563.  
  6564.  
  6565.  
  6566.  
  6567.  
  6568.  
  6569.  
  6570.  
  6571.  
  6572.  
  6573.  
  6574.  
  6575.  
  6576.  
  6577.  
  6578.  
  6579.  
  6580.  
  6581.  
  6582.  
  6583.  
  6584.  
  6585.  
  6586.  
  6587.  
  6588.  
  6589.  
  6590.  
  6591.  
  6592.  
  6593.  
  6594.  
  6595.                        Copyright (c) 1987, AJM Software 
  6596.                                    -Page 99-
  6597.  
  6598.  
  6599.  
  6600.  
  6601.  
  6602.  
  6603.  
  6604.  
  6605.  
  6606.  
  6607.  
  6608.  
  6609.  
  6610.       DOSPDEL  - Delete a file from the queue
  6611.  
  6612.       Usage - Call DosPDel(FileSpec$, Rc%)
  6613.  
  6614.          Filespec$             ASCIIZ string
  6615.  
  6616.          Rc%                   Return code
  6617.  
  6618.  
  6619.       Programming notes:
  6620.  
  6621.       Filespec$ should be the name of a file in the print queue in ASCIIZ for-
  6622.       mat.  ASCIIZ format is simply the file name followed by a CHR$(0), for
  6623.       example:
  6624.  
  6625.               Filespec$  = "C:\SPOOLDIR\TEXTFILE.DAT" +CHR$(0)
  6626.  
  6627.       You must use the entire filename (including drive and path) when deleting
  6628.       a file from the queue.
  6629.  
  6630.       See Appendix E for an explanation of return codes.
  6631.  
  6632.       This service will delete a files from the print queue.  Please remember
  6633.       that most printers have a print buffer - some as large as 256k.  This
  6634.       function will not clear the print buffer, so if the deleted file is print-
  6635.       ing, it will continue to print until the buffer is emptied.
  6636.  
  6637.  
  6638.  
  6639.  
  6640.  
  6641.  
  6642.  
  6643.  
  6644.  
  6645.  
  6646.  
  6647.  
  6648.  
  6649.  
  6650.  
  6651.  
  6652.  
  6653.  
  6654.  
  6655.  
  6656.  
  6657.  
  6658.  
  6659.  
  6660.  
  6661.                        Copyright (c) 1987, AJM Software 
  6662.                                    -Page 100-
  6663.  
  6664.  
  6665.  
  6666.  
  6667.  
  6668.  
  6669.  
  6670.  
  6671.  
  6672.  
  6673.  
  6674.  
  6675.  
  6676.       DOSPLST  - List all files in the queue
  6677.  
  6678.       Usage - Call DosPLst(File.Array$(0), Rc%)
  6679.  
  6680.          File.Array$           Array that will contain the names of all the
  6681.                                files in the print queue
  6682.  
  6683.          Rc%                   Return code
  6684.  
  6685.  
  6686.       Programming notes:
  6687.  
  6688.       See Appendix E for a explanation of return codes.
  6689.  
  6690.       File.Array$ must be initialized and have the proper number of elements
  6691.       prior to calling DOSPLST.  Failing to initialize it properly will cause
  6692.       DOSPLST to fail and probably freeze up your computer.
  6693.  
  6694.       The maximum number of entries depends on what parameters were used when
  6695.       the print spooler was started.  The absolute maximum is 32.  I would
  6696.       strongly recommend that you plan for the maximum.  The following code seg-
  6697.       ment shows the proper method of using DOSPLST.
  6698.  
  6699.               MaxQueue%  = 31                   'This is really 32 entries when
  6700.                                                 'using Option Base 0
  6701.               Dim File.Array$(MaxQueue%)        'plan for max number of entries
  6702.  
  6703.               For X% = 0 to MaxQueue%           'initialize the array
  6704.                         File.Array$ = Space$(64) 'max length of a filename
  6705.               Next
  6706.  
  6707.               Call DosPLst(File.Array$(0), Rc%) 'go get list
  6708.  
  6709.               If Rc% <> 0 then goto YOUR.ERROR.ROUTINE
  6710.  
  6711.  
  6712.  
  6713.  
  6714.  
  6715.  
  6716.  
  6717.  
  6718.  
  6719.  
  6720.  
  6721.  
  6722.  
  6723.  
  6724.  
  6725.  
  6726.  
  6727.                        Copyright (c) 1987, AJM Software 
  6728.                                    -Page 101-
  6729.  
  6730.  
  6731.  
  6732.  
  6733.  
  6734.  
  6735.  
  6736.  
  6737.  
  6738.  
  6739.  
  6740.  
  6741.  
  6742.       DOSPSUB  - Submit a file to the queue
  6743.  
  6744.  
  6745.       Usage - Call DosPSub(FileSpec$, Rc%)
  6746.  
  6747.          FileSpec$             ASCIIZ string
  6748.  
  6749.          Rc%                   Return code
  6750.  
  6751.  
  6752.       Programming notes:
  6753.  
  6754.       FileSpec$ is the name of the file to be submitted to the print queue.
  6755.  
  6756.       See Appendix E for an explanation of return codes.
  6757.  
  6758.       The file is placed at the tail of the print queue.  It will not print
  6759.       until all other files ahead of it have already printed.  There is no way
  6760.       of prioritizing the files with the services presented here.
  6761.  
  6762.  
  6763.  
  6764.  
  6765.  
  6766.  
  6767.  
  6768.  
  6769.  
  6770.  
  6771.  
  6772.  
  6773.  
  6774.  
  6775.  
  6776.  
  6777.  
  6778.  
  6779.  
  6780.  
  6781.  
  6782.  
  6783.  
  6784.  
  6785.  
  6786.  
  6787.  
  6788.  
  6789.  
  6790.  
  6791.  
  6792.  
  6793.                        Copyright (c) 1987, AJM Software 
  6794.                                    -Page 102-
  6795.  
  6796.  
  6797.  
  6798.  
  6799.  
  6800.  
  6801.  
  6802.  
  6803.  
  6804.  
  6805.  
  6806.  
  6807.  
  6808.  
  6809.                                 DOS Memory Management
  6810.  
  6811.  
  6812.               PLEASE READ APPENDIX F BEFORE USING ANY OF THESE SERVICES
  6813.  
  6814.  
  6815.       Function Summary
  6816.  
  6817.  
  6818.       DOSMALLC - Allocate additional memory
  6819.  
  6820.       DOSMFREE - Free memory
  6821.  
  6822.       DOSMGET  - Get some data from allocated memory
  6823.  
  6824.       DOSMPUT  - Put some data in allocated memory
  6825.  
  6826.  
  6827.  
  6828.  
  6829.  
  6830.  
  6831.  
  6832.  
  6833.  
  6834.  
  6835.  
  6836.  
  6837.  
  6838.  
  6839.  
  6840.  
  6841.  
  6842.  
  6843.  
  6844.  
  6845.  
  6846.  
  6847.  
  6848.  
  6849.  
  6850.  
  6851.  
  6852.  
  6853.  
  6854.  
  6855.  
  6856.  
  6857.  
  6858.  
  6859.                        Copyright (c) 1987, AJM Software 
  6860.                                    -Page 103-
  6861.  
  6862.  
  6863.  
  6864.  
  6865.  
  6866.  
  6867.  
  6868.  
  6869.  
  6870.  
  6871.  
  6872.  
  6873.       DOSMALLC - Allocate additional memory
  6874.  
  6875.       Usage - Call DosMAllc(Block, MemSize%, Element.Size%, Rc%)
  6876.  
  6877.          Block%         Reserved for future use
  6878.  
  6879.          MemSize%       Amount of memory to acquire (in Kilobytes)
  6880.                         valid ranges are 1-64
  6881.  
  6882.          Element.Size%  Size of each array element.
  6883.  
  6884.          Rc%            Return code
  6885.  
  6886.  
  6887.       Programming notes:
  6888.  
  6889.       See Appendix F before using this service.
  6890.  
  6891.       Return code is explained in Appendix F.
  6892.  
  6893.       MemSize% is the memory size in KB - 64 would get 64,000 additional bytes.
  6894.  
  6895.       The area of memory returned by this service is initialized to
  6896.       nulls - CHR$(0).
  6897.  
  6898.       Only 1 area of memory can be allocated at any one time.  If this service
  6899.       is attempted twice without an intervening call to DOSMFREE, the second
  6900.       call to DOSMALLC will fail.
  6901.  
  6902.       This service is the equivalent of the BASIC function DIM when used with a
  6903.       dynamic array.
  6904.  
  6905.  
  6906.  
  6907.  
  6908.  
  6909.  
  6910.  
  6911.  
  6912.  
  6913.  
  6914.  
  6915.  
  6916.  
  6917.  
  6918.  
  6919.  
  6920.  
  6921.  
  6922.  
  6923.  
  6924.  
  6925.                        Copyright (c) 1987, AJM Software 
  6926.                                    -Page 104-
  6927.  
  6928.  
  6929.  
  6930.  
  6931.  
  6932.  
  6933.  
  6934.  
  6935.  
  6936.  
  6937.  
  6938.  
  6939.  
  6940.       DOSMFREE - Free memory
  6941.  
  6942.       Call DosMFree(Block%, Rc%)
  6943.  
  6944.          Block%         Reserved for future use
  6945.  
  6946.          Rc%            Return code
  6947.  
  6948.  
  6949.       Programming notes:
  6950.  
  6951.       See Appendix F before using this service.
  6952.  
  6953.       Return code is explained in Appendix F.
  6954.  
  6955.       This service will free all memory obtained with DOSMALLC.
  6956.  
  6957.       This service is the equivalent of the BASIC function ERASE when used with
  6958.       a dynamic array.
  6959.  
  6960.  
  6961.  
  6962.  
  6963.  
  6964.  
  6965.  
  6966.  
  6967.  
  6968.  
  6969.  
  6970.  
  6971.  
  6972.  
  6973.  
  6974.  
  6975.  
  6976.  
  6977.  
  6978.  
  6979.  
  6980.  
  6981.  
  6982.  
  6983.  
  6984.  
  6985.  
  6986.  
  6987.  
  6988.  
  6989.  
  6990.  
  6991.                        Copyright (c) 1987, AJM Software 
  6992.                                    -Page 105-
  6993.  
  6994.  
  6995.  
  6996.  
  6997.  
  6998.  
  6999.  
  7000.  
  7001.  
  7002.  
  7003.  
  7004.  
  7005.       DOSMGET  - Get some data from allocated memory
  7006.  
  7007.       Usage Call DosMGet(Block%, Index%, Text$, Rc%)
  7008.  
  7009.          Block%         Reserved for future use
  7010.  
  7011.          Index%         Array element number to retrieve
  7012.  
  7013.          Text$          String that will contain the data returned from memory
  7014.  
  7015.          Rc%            Return code
  7016.  
  7017.  
  7018.       Programming notes:
  7019.  
  7020.       See Appendix F before using this service.
  7021.  
  7022.       Return code is explained in Appendix F.
  7023.  
  7024.       Text$ must be initialized to the proper length prior to using this ser-
  7025.       vice.  It's length must equal the value of Element.Size% used in DOSMALLC.
  7026.  
  7027.       Index% the offset into the array where the requested data resides.  The
  7028.       minimum value for Index% is 0 - the maximum value is determined by the
  7029.       following formula:
  7030.  
  7031.          MaxIdx%  = Int(Max.Size%/Element.Size% *1000) - 1
  7032.  
  7033.  
  7034.  
  7035.  
  7036.  
  7037.  
  7038.  
  7039.  
  7040.  
  7041.  
  7042.  
  7043.  
  7044.  
  7045.  
  7046.  
  7047.  
  7048.  
  7049.  
  7050.  
  7051.  
  7052.  
  7053.  
  7054.  
  7055.  
  7056.  
  7057.                        Copyright (c) 1987, AJM Software 
  7058.                                    -Page 106-
  7059.  
  7060.  
  7061.  
  7062.  
  7063.  
  7064.  
  7065.  
  7066.  
  7067.  
  7068.  
  7069.  
  7070.  
  7071.       DOSMPUT  - Put some data in allocated memory
  7072.  
  7073.       Usage Call DosMPut(Block%, Index%, Text$, Rc%)
  7074.  
  7075.          Block%         Reserved for future use
  7076.  
  7077.          Index%         Array element number where data will be placed
  7078.  
  7079.          Text$          String containing the data to be placed into the array
  7080.  
  7081.          Rc%            Return code
  7082.  
  7083.  
  7084.       Programming notes:
  7085.  
  7086.       See Appendix F before using this service.
  7087.  
  7088.       Return code is explained in Appendix F.
  7089.  
  7090.       The length of Text$ cannot exceed the value of Element.Size%.
  7091.  
  7092.       Index% the offset into the array where the data will be placed.  The
  7093.       minimum value for Index% is 0 - the maximum value is determined by the
  7094.       following formula:
  7095.  
  7096.          MaxIdx%  = Int(Max.Size%/Element.Size% *1000) - 1
  7097.  
  7098.  
  7099.  
  7100.  
  7101.  
  7102.  
  7103.  
  7104.  
  7105.  
  7106.  
  7107.  
  7108.  
  7109.  
  7110.  
  7111.  
  7112.  
  7113.  
  7114.  
  7115.  
  7116.  
  7117.  
  7118.  
  7119.  
  7120.  
  7121.  
  7122.  
  7123.                        Copyright (c) 1987, AJM Software 
  7124.                                    -Page 107-
  7125.  
  7126.  
  7127.  
  7128.  
  7129.  
  7130.  
  7131.  
  7132.  
  7133.  
  7134.  
  7135.  
  7136.  
  7137.  
  7138.                                       Appendix A
  7139.  
  7140.                                  Keyboard Scan Codes
  7141.  
  7142.  
  7143.       Decimal           Character
  7144.  
  7145.       3                 NUL
  7146.       15                Shft-tab
  7147.       16-25             Alt+(Q,W,E,R,T,Y,U,I,O,P)
  7148.       30-38             Alt+(A,S,D,F,G,H,J,K,L)
  7149.       44-50             Alt+(Z,X,C,V,B,N,M)
  7150.       59,68             F1-F10
  7151.       71                Home
  7152.       72                Up cursor
  7153.       73                PgUp
  7154.       75                Left cursor
  7155.       77                Right cursor
  7156.       79                End
  7157.       80                Down cursor
  7158.       81                PgDn
  7159.       82                Ins
  7160.       83                Del
  7161.       84-93             Shft-(F1-F10)
  7162.       94-103            Ctrl-(F1-F10)
  7163.       104-113           Alt+(F1-F10)
  7164.       114               PrtSc
  7165.       115               Left cursor
  7166.       116               Right cursor
  7167.       117               End
  7168.       118               PgDn
  7169.       119               Home
  7170.       120-131           Alt+(1,2,3,4,5,6,7,8,9,0,-,=)
  7171.       132               PgUp
  7172.  
  7173.  
  7174.  
  7175.  
  7176.  
  7177.  
  7178.  
  7179.  
  7180.  
  7181.  
  7182.  
  7183.  
  7184.  
  7185.  
  7186.  
  7187.  
  7188.  
  7189.                        Copyright (c) 1987, AJM Software 
  7190.                                    -Page 108-
  7191.  
  7192.  
  7193.  
  7194.  
  7195.  
  7196.  
  7197.  
  7198.  
  7199.  
  7200.  
  7201.  
  7202.  
  7203.                                       Appendix B
  7204.  
  7205.                                      BASIC Colors
  7206.  
  7207.  
  7208.       Color code               Color
  7209.  
  7210.          0                     Black
  7211.          1                     Blue
  7212.          2                     Green
  7213.          3                     Cyan
  7214.          4                     Red
  7215.          5                     Magenta
  7216.          6                     Brown
  7217.          7                     White
  7218.          8                     Gray
  7219.          9                     Light Blue
  7220.          10                    Light Green
  7221.          11                    Light Cyan
  7222.          12                    Light Red
  7223.          13                    Light Magenta
  7224.          14                    Yellow
  7225.          15                    High-Intensity White
  7226.  
  7227.  
  7228.       Notes:
  7229.  
  7230.       The only valid background colors are 0-7.
  7231.  
  7232.       Add 16 (sixteen) to the color to cause blinking.
  7233.  
  7234.  
  7235.  
  7236.  
  7237.  
  7238.  
  7239.  
  7240.  
  7241.  
  7242.  
  7243.  
  7244.  
  7245.  
  7246.  
  7247.  
  7248.  
  7249.  
  7250.  
  7251.  
  7252.  
  7253.  
  7254.  
  7255.                        Copyright (c) 1987, AJM Software 
  7256.                                    -Page 109-
  7257.  
  7258.  
  7259.  
  7260.  
  7261.  
  7262.  
  7263.  
  7264.  
  7265.  
  7266.  
  7267.  
  7268.  
  7269.                                       Appendix C
  7270.  
  7271.                               About Disks and Diskettes
  7272.  
  7273.  
  7274.       DISK AND DISK FORMATS
  7275.  
  7276.       Hard disks and floppy disks essentially use the same format under DOS.
  7277.       There are four logical areas of interest on each disk - the boot sector,
  7278.       the FAT, the root directory and the data area.  Physically, data is
  7279.       recorded on a series of tracks.  Each track is further divided into areas
  7280.       called sectors.  The physical capacity of each disk varies considerably
  7281.       from drive to drive.
  7282.  
  7283.  
  7284.       There are only two characteristics of disks that are fixed by hardware
  7285.       constraints - the number of sides and the location of each track on the
  7286.       disk.  The size and number of sectors and their location within each track
  7287.       is totally under software control.  Each of these characteristics is def-
  7288.       ined by the formatting software (the FORMAT program usually).  We'll dis-
  7289.       cuss most of the DOS formats shortly.  Sectors can be placed on a track in
  7290.       any order and in any combination of 4 sizes - 128, 256, 512 or 1024 bytes.
  7291.       Generally it is wise to use a sector size of 512 bytes because that's the
  7292.       standard and there are probably many programs, including DOS, that depend
  7293.       on a 512 byte sector size.
  7294.  
  7295.       There are several standard formats currently used by DOS.  The following
  7296.       table summarizes each format and it's characteristics.
  7297.  
  7298.  
  7299.                Type       Sides        Sectors      Tracks      Bytes
  7300.  
  7301.                SSDD-8      1             8            40         160,000
  7302.                DSDD-8      2             8            40         320,000
  7303.                SSDD-9      1             9            40         180,000
  7304.                DSDD-9      2             9            40         360,000
  7305.                3 1/2 in.   2             9            80         720,000
  7306.                DDHD        2             15           80       1,200,000
  7307.  
  7308.       The most common of these formats is the DSDD-9, but with the introduction
  7309.       of laptops and the PS/2 line from IBM, the 3 1/2 in. diskettes will prob-
  7310.       ably become the standard of the future.  When using the BIOS to access
  7311.       disks, it is important to understand their characteristics.  Bios disk
  7312.       access routines require us to know three things about the particular sec-
  7313.       tor that we're looking for.  These are the track number, the cylinder num-
  7314.       ber, and the sector number,  The first track on a disk is always 0.  Dis-
  7315.       kettes with 40 tracks will have them numbered 0 - 39.  The cylinder number
  7316.       is sometimes called the side or head number.  It really represents which
  7317.       side of the diskette we want to read, top or bottom.  Cylinder is 0 for
  7318.       top or 1 for bottom.  Hard disks may have more than two cylinders.
  7319.  
  7320.  
  7321.                        Copyright (c) 1987, AJM Software 
  7322.                                    -Page 110-
  7323.  
  7324.  
  7325.  
  7326.  
  7327.  
  7328.  
  7329.  
  7330.  
  7331.  
  7332.  
  7333.  
  7334.  
  7335.       Sector numbers always start with 1.  Therefore, the first sector on a disk
  7336.       is always Track 0, Cylinder 0, Sector 1.
  7337.  
  7338.  
  7339.       As I said earlier, DOS organizes the disk into four areas.  We'll examine
  7340.       each of these separately.
  7341.  
  7342.  
  7343.       The Boot Sector
  7344.  
  7345.       The boot sector contains a short program used to start the computer and it
  7346.       also contains the characteristics of the disk in an area called the BIOS
  7347.       parameter block.  The short program does one of two things - it loads the
  7348.       three startup modules, IBMBIO.COM, IBMDOS.COM, and COMMAND.COM and trans-
  7349.       fers control to COMMAND.COM or it displays a message stating that the dis-
  7350.       kette is not a bootable one.  The format of the boot sector is as follows:
  7351.  
  7352.          Location         Description
  7353.  
  7354.             0-2           Branch to first byte of boot code
  7355.             3-29         BIOS parameter block
  7356.  
  7357.             3-10          System ID
  7358.             11-12         Number of bytes/sector
  7359.             13            Number of sectors/cluster
  7360.             14-15         Number of reserved sectors at beginning
  7361.             16            Number of FAT's
  7362.             17-18         Number of root directory entries
  7363.             19-20         Total number of sectors on disk
  7364.             21            Format ID
  7365.             22-23         Number of sectors/FAT
  7366.             24-25         Number of sectors/track
  7367.             26-27         Number of cylinders
  7368.             28-29         Number of special reserved sectors
  7369.  
  7370.  
  7371.       The rest of the boot program follows the BIOS parameter block.  At the end
  7372.       of the boot record, we need the two-byte signature, a hex 55AA.
  7373.  
  7374.  
  7375.  
  7376.       The Root Directory
  7377.  
  7378.       The directory holds basic information about each file.  There can, of
  7379.       course, be more than one directory, but there is only one root directory.
  7380.       Subdirectories have essentially the same format as the root directory, but
  7381.       there is one notable difference.  A subdirectory is really another file -
  7382.       a special type of file.  As a file, it can grow to virtually any size and
  7383.       have any number of entries (not totally true, but there are no PRACTICAL
  7384.       limits).  The root directory is fixed in length and therefore can have
  7385.  
  7386.  
  7387.                        Copyright (c) 1987, AJM Software 
  7388.                                    -Page 111-
  7389.  
  7390.  
  7391.  
  7392.  
  7393.  
  7394.  
  7395.  
  7396.  
  7397.  
  7398.  
  7399.  
  7400.  
  7401.  
  7402.       only a limited number of entries.  This is usually 64 or 112.  Each entry
  7403.       in the directory uses 32 bytes, so we are limited to sixteen entries per
  7404.       sector.  Each entry contains the following eight fields:
  7405.  
  7406.          Position      Description
  7407.  
  7408.          0-7            Filename
  7409.          8-10           Filename extension
  7410.          11             Attribute
  7411.          12-21          Reserved
  7412.          22-23          Last update time
  7413.          24-25          Last update date
  7414.          26-27          First FAT entry
  7415.          28-31          File size
  7416.  
  7417.  
  7418.       The Data Area
  7419.  
  7420.       The data area is the largest area on the disk.  It is where our files are
  7421.       actually placed.  Space is allocated in units called clusters.  A cluster
  7422.       is made up of one or more sectors.  This is defined at disk format time.
  7423.       That all we need to know about the data area.
  7424.  
  7425.  
  7426.  
  7427.       THE FAT
  7428.  
  7429.       The FAT - file allocation table - keeps track of where our files physi-
  7430.       cally reside on disk.   The directory entry for each file contains the
  7431.       address of the first sector that the file occupies.  If the file occupies
  7432.       more than 1 sector, DOS keeps track of it in the FAT.  There are generally
  7433.       two copies of the FAT on every disk.  DOS updates both copies, but only
  7434.       uses one of them for file retrieval.  FAT's have one of two formats - a 12
  7435.       bit or a 16 bit format.  The 12 bit format allows you to access just over
  7436.       4,000 clusters, so it is used primarily in diskettes and the smaller hard
  7437.       disks.  The 16 bit format allows us to access many more clusters and
  7438.       facilitate larger hard disks.  It is because of the FAT entry size that we
  7439.       are limited, by DOS, to a maximum 32 Meg hard disk (although there are
  7440.       several programs, such as SPEEDSTOR by Storage Dimensions, Inc. that do
  7441.       away with this limitation and in fact, some versions of DOS 3.3x also pro-
  7442.       vide work-arounds for this limit - the most notable being COMPAQ DOS
  7443.       3.31).  
  7444.  
  7445.       Each byte in the FAT represents a cluster and tells us the disposition of
  7446.       that cluster.  The first two bytes in the FAT are reserved and are not
  7447.       used for this purpose.  
  7448.  
  7449.  
  7450.  
  7451.  
  7452.  
  7453.                        Copyright (c) 1987, AJM Software 
  7454.                                    -Page 112-
  7455.  
  7456.  
  7457.  
  7458.  
  7459.  
  7460.  
  7461.  
  7462.  
  7463.  
  7464.  
  7465.  
  7466.  
  7467.       For illustration, we will use a 12 bit FAT.  The allowable values in each
  7468.       entry are:
  7469.  
  7470.          Value          Description
  7471.  
  7472.           0             The cluster is unused and available for use
  7473.           1-FF0(4080)   A pointer to the next cluster that this file occupies.
  7474.           FF7(4087)     The cluster has been flagged as unusable by FORMAT.  This
  7475.                         occurs when the format program cannot successfully write
  7476.                         to one of the sectors in the cluster.
  7477.           FFE(4094)     The cluster is not used but is unavailable for use.
  7478.                         This occurs only when DOS reserves a cluster.
  7479.           FFF(4095)     This indicates that this is the last cluster that a file
  7480.                         occupies.
  7481.  
  7482.       As you can see, the FAT links together the clusters that make up a file.
  7483.       It is also easy to see that if the FAT becomes damaged, your disk or dis-
  7484.       kette becomes so much trash.  In general, it's not a good idea to manipu-
  7485.       late the FAT unless your an experienced programmer.
  7486.  
  7487.  
  7488.  
  7489.  
  7490.       FORMATTING A DISKETTE
  7491.  
  7492.       Please keep in mind that these procedures are directed to a floppy disk
  7493.       only.  In principle, formatting a hard disk is similar, but don't try it
  7494.       with these guidelines.
  7495.  
  7496.       Formatting a diskette is a four-step process.
  7497.  
  7498.          1    Format each track of the diskette
  7499.          2    Write the boot sector
  7500.          3    Initialize the FAT
  7501.          4    Initialize the root directory
  7502.  
  7503.       We can format each track of a diskette using the BsDFmt service provided
  7504.       in QBWARE/1.  Note that this service requires the use of a 'track format
  7505.       table'.  This table contains a 4-bytes descriptor for each sector being
  7506.       formatted.  Individual sectors cannot be formatted.  You must format an
  7507.       entire track with one BIOS call but the track format table lets us define
  7508.       the characteristics of each sector.  The track format table looks like
  7509.       this:
  7510.  
  7511.          Byte 1     - track being formatted
  7512.          Byte 2     - Head being formatted
  7513.          Byte 3     - Sector being formatted
  7514.          Byte 4     - size code
  7515.  
  7516.  
  7517.  
  7518.  
  7519.                        Copyright (c) 1987, AJM Software 
  7520.                                    -Page 113-
  7521.  
  7522.  
  7523.  
  7524.  
  7525.  
  7526.  
  7527.  
  7528.  
  7529.  
  7530.  
  7531.  
  7532.  
  7533.  
  7534.       The size code has the following values:
  7535.  
  7536.          0    128 byte sectors
  7537.          1    256 byte sectors
  7538.          2    512 byte sectors
  7539.          3    1024 byte sectors
  7540.  
  7541.       The following program would format an entire DSDD-9 conventional diskette.
  7542.  
  7543.          DataBuffer$ = Space$(36)
  7544.          For Track% = 0 to 39
  7545.               For Head% = 0 to 1
  7546.                    For Sector% = 1 to 9
  7547.                         Mid$(DataBuffer$,((Sector%-1)*4)+1) =  _
  7548.                                Chr$(Track%)+Chr$(Head%)+Chr$(Sector%)+Chr$(2)
  7549.                    Next Sector%
  7550.                    Call BsDFmt(DataBuffer$,"A",Head%,Track%,9%,Rc%)
  7551.               Next Head%
  7552.          Next Track%
  7553.  
  7554.       Of course, this routine does not do any error checking.
  7555.  
  7556.       Once this has completed, we can continue to write the boot sector, FAT,
  7557.       and root directory.  These are beyond the scope of this discussion, but if
  7558.       you need help in doing this, please drop me a note and I'll see what I can
  7559.       do.
  7560.  
  7561.  
  7562.  
  7563.       COPY PROTECTION
  7564.  
  7565.       Using the BIOS format service, we can devise our own copy protection
  7566.       schemes.  These schemes are not as elaborate as the schemes used by some
  7567.       of the larger software houses (these actually use special hardware to
  7568.       put junk in places on a diskette that are read-only accessible to a
  7569.       standard floppy controller), but can be effective against the casual soft-
  7570.       ware pirate.  The means available to us are:
  7571.  
  7572.        - leave out a sector number in the track format table
  7573.        - place a unique number in the track format table
  7574.        - format ten sectors on one or more tracks
  7575.        - change the sizes of one or more sectors on a track
  7576.        - format past track 39
  7577.        - change the interleave
  7578.  
  7579.       Be careful, not all of these techniques work consistently with all floppy
  7580.       disk controllers.
  7581.  
  7582.  
  7583.  
  7584.  
  7585.                        Copyright (c) 1987, AJM Software 
  7586.                                    -Page 114-
  7587.  
  7588.  
  7589.  
  7590.  
  7591.  
  7592.  
  7593.  
  7594.  
  7595.  
  7596.  
  7597.                                       APPENDIX D
  7598.  
  7599.                             Using the File Access Services
  7600.  
  7601.  
  7602.       All of the file access services use the DOS extended file services.  These
  7603.       services call for the use of file handles - a UNIX concept.  Because of
  7604.       this we are still limited to a maximum of 20 open files in any Quickbasic
  7605.       program. This includes the 5 standard files that DOS requires effectively
  7606.       limiting any Quickbasic program to 15 open files at any one time.  This
  7607.       should normally be enough, however, if it becomes a problem, there are
  7608.       some facilities in QBWARE/1 that will allow you to open more than 15
  7609.       files, but still we cannot exceed 20.  If you must have more than 20 open
  7610.       files, you must use the old FCB style file services.  This will allow you
  7611.       to access up to 255 files simultaneously.  These routines are available
  7612.       from AJM Software and if you'd like them, just write (Note: DOS 3.3
  7613.       will allow 255 open files, so, that's you're best bet).
  7614.  
  7615.  
  7616.       Using the file access services requires the use of an ASCIIZ string.  This
  7617.       is simply a file name (or part of a file name) followed by a null.  Some
  7618.       examples of ASCIIZ strings:
  7619.  
  7620.               FlSpec$ = "C:COMMAND.COM" + Chr$(0)
  7621.               Path$   = "\QUICKBAS" + Chr$(0)
  7622.  
  7623.  
  7624.       The standard error codes for all of the QBWARE/1 file management routines
  7625.       except FLRSECT and FLWSECT are as follows:
  7626.  
  7627.          Code           Reason
  7628.  
  7629.          0              service completed successfully
  7630.          1              invalid request
  7631.          2              file not found or path invalid
  7632.          3              path not found
  7633.          4              no handle available
  7634.          5              access denied
  7635.          6              invalid handle
  7636.          12             invalid access code
  7637.          15             invalid drive specification
  7638.          17             not the same device (FLMOVE only)
  7639.          18             no matching directory entry found
  7640.          22             attempt to delete current directory
  7641.          80             file already exists
  7642.         255             invalid parameter
  7643.  
  7644.  
  7645.  
  7646.  
  7647.  
  7648.  
  7649.  
  7650.  
  7651.                        Copyright (c) 1987, AJM Software 
  7652.                                    -Page 115-
  7653.  
  7654.  
  7655.  
  7656.  
  7657.  
  7658.  
  7659.  
  7660.  
  7661.  
  7662.  
  7663.  
  7664.                                       Appendix E
  7665.  
  7666.                                   The Print Spooler
  7667.  
  7668.  
  7669.       Version 3.00 of DOS brought with it a remarkable new program - the print
  7670.       spooler.  The spooler is remarkable because it allows you to print files
  7671.       in the background while the computer is free to do other tasks.  It is
  7672.       somewhat limited in that it does automatically capture data going to the
  7673.       printer and spool it for you and it must be used from the DOS prompt.  In
  7674.       order to use it, you must write your report to a file and subsequently go
  7675.       to the DOS prompt and submit it to the print queue - either manually or
  7676.       through a batch file.  The services provided in QBWARE/1 will assist in
  7677.       incorporating the spooler into any Quickbasic system.  You must still
  7678.       write each report to a file, but we can, with DOSPSUB, submit the file to
  7679.       the print queue directly from a Quickbasic program.
  7680.  
  7681.  
  7682.       In order to use QBWARE/1 spooler service, we must start the spooler
  7683.       before your Quickbasic basic program executes.  The spooler can be started
  7684.       from the DOS prompt or from your AUTOEXEC.BAT file (any BAT file will do).
  7685.       The spooler program is called PRINT.EXE and is available on your DOS ver-
  7686.       sion 3.XX diskettes.  When starting the spooler, there are several options
  7687.       that can be used.  These are:
  7688.  
  7689.          /D   Device that all files will be printed on - if omitted, the spooler
  7690.               will prompt you for a device name
  7691.  
  7692.          /Q   Maximum number of files that can be in the print queue - the
  7693.               default is 4 and the absolute maximum that can be used is 32
  7694.  
  7695.          /B   Buffersize of the internal buffer used by the spooler - the
  7696.               default is 512 bytes - we always use 2048 bytes, but the correct
  7697.               value will depend on overall system usage
  7698.  
  7699.          /S   Timeslice for the spooler - this defines the number of clock ticks
  7700.               that the spooler will use - the default is 8 and the values can
  7701.               range from 1-255
  7702.  
  7703.          /M   Specifies the maximum number of clockticks that the spooler will
  7704.               use to print a character - values can be 1-255 and the default is
  7705.               2
  7706.  
  7707.          /U   Specifies the number of clockticks that the spooler will wait for
  7708.               the printer to become available - values can range from 1-255 and
  7709.               the default is 1
  7710.  
  7711.  
  7712.  
  7713.  
  7714.  
  7715.  
  7716.  
  7717.                        Copyright (c) 1987, AJM Software 
  7718.                                    -Page 116-
  7719.  
  7720.  
  7721.  
  7722.  
  7723.  
  7724.  
  7725.  
  7726.  
  7727.  
  7728.  
  7729.  
  7730.  
  7731.       The command
  7732.  
  7733.          PRINT /D:LPT1 /B:2048 /Q:32
  7734.  
  7735.       will activate the spooler with an internal buffer of 2048 bytes and cause
  7736.       all output to be spooled to LPT1.  The maximum number of files that can be
  7737.       in the queue at one time is 32.  Once this is completed, the routines in
  7738.       QBWARE/1 can be used.
  7739.  
  7740.       Return codes from the spooler are as follows:
  7741.  
  7742.          Rc             Reason
  7743.  
  7744.          0              Successful
  7745.          1              Spooler inactive
  7746.          2              Spooler inactive (DOSPSTAT only)
  7747.          2              File not found
  7748.          3              Path not found
  7749.          4              Too many open files
  7750.          5              Access denied
  7751.          8              Queue full
  7752.          9              Spooler busy
  7753.          12             Name too long
  7754.          15             Invalid drive
  7755.          255            Invalid DOS version
  7756.  
  7757.  
  7758.  
  7759.  
  7760.  
  7761.  
  7762.  
  7763.  
  7764.  
  7765.  
  7766.  
  7767.  
  7768.  
  7769.  
  7770.  
  7771.  
  7772.  
  7773.  
  7774.  
  7775.  
  7776.  
  7777.  
  7778.  
  7779.  
  7780.  
  7781.  
  7782.  
  7783.                        Copyright (c) 1987, AJM Software 
  7784.                                    -Page 117-
  7785.  
  7786.  
  7787.  
  7788.  
  7789.  
  7790.  
  7791.  
  7792.  
  7793.  
  7794.  
  7795.  
  7796.  
  7797.                                       Appendix F
  7798.  
  7799.                             Using the DOS Memory Services
  7800.  
  7801.  
  7802.  
  7803.       NOTE:
  7804.  
  7805.       If you are using QuickBasic V4, do not read this section.  You can use the
  7806.       DOS Memory Service after shrinking memory within QuickBasic through the
  7807.       SETMEM function.  If you're not using QB4 - read on!!!!
  7808.  
  7809.  
  7810.  
  7811.  
  7812.  
  7813.       General info
  7814.  
  7815.  
  7816.       The Dos Memory Services provided in QBWARE/1 will allow you to allocate
  7817.       an array of up to 64,000 characters in length.  This array is handled like
  7818.       text data, but unlike BASIC, QBWARE/1 does not allow variable length
  7819.       strings.  This data resides outside of the Quickbasic data segment, so it
  7820.       has no effect on the amount of string space normally provided by Quickba-
  7821.       sic.  This array is handled a little bit differently than a Quickbasic
  7822.       array would be.  Let's look at some examples.
  7823.  
  7824.       In Quickbasic, we could allocate an array and initialize a single element
  7825.       with the following code segment:
  7826.  
  7827.          Option Base 0
  7828.          Dim Array$(400)
  7829.  
  7830.          Array$(0) = "This is the first element of the array"
  7831.  
  7832.  
  7833.  
  7834.       Using the services in QBWARE/1, we could do this:
  7835.  
  7836.          Mem.Size% = 64        'Allocate 64,000 bytes
  7837.          Element.Size% = 100   'Need element size because QBWARE/1 does not
  7838.                                'support variable length text
  7839.  
  7840.          Call DosMAllc(Block%, Mem.Size%, Element.Size%, Rc%)
  7841.          If Rc% <> 0 then Goto Error.Routine
  7842.  
  7843.          Text$ = "This is the first element of the array"
  7844.          Index% = 0
  7845.          Call DosMPut(Block%, Index%, Text$, Rc%)
  7846.  
  7847.  
  7848.  
  7849.                        Copyright (c) 1987, AJM Software 
  7850.                                    -Page 118-
  7851.  
  7852.  
  7853.  
  7854.  
  7855.  
  7856.  
  7857.  
  7858.  
  7859.  
  7860.  
  7861.  
  7862.  
  7863.       In the Quickbasic example, we first allocate enough memory for 400 items
  7864.       in the array called Array$ (Note that this doesn't mean that you can actu-
  7865.       ally use all 400.  If you tried to initialized each element of Array$ to
  7866.       200 spaces, your program would run out of string space long before you
  7867.       completed the initialization).  All this actually does is set aside 1600
  7868.       bytes within Quickbasic.  This 1600 bytes is used as a series of 'string
  7869.       descriptors' - you can read the Quickbasic manual for a discussion of
  7870.       string descriptors.  Next, we assign a value to the first element in the
  7871.       array.  Quickbasic allocates some space in it's own data segment for this
  7872.       value and updates the string descriptor accordingly.  The descriptor con-
  7873.       tains the length of the string and it's location within the Quickbasic
  7874.       data segment.
  7875.  
  7876.       In the QBWARE/1 example, we first need to allocate some space.  The
  7877.       amount of space needed is 64,000 characters, or bytes.  This is done by
  7878.       setting 
  7879.               Mem.Size = 64
  7880.  
  7881.       Next, because QBWARE/1 will not support variable length text, we need to
  7882.       determine the length of each element.  For all practical purposes, this is
  7883.       the length of the longest element that we will place into the array.  Next
  7884.       we allocate space for the array using DOSMALLC.  This service actually
  7885.       allocates the entire 64,000 bytes.  In order to initialize on of the ele-
  7886.       ments of our new array, all we need do is specify the element number, or
  7887.       index, and the text itself - DOSMPUT will do the rest.  Keep in mind that
  7888.       if the length of the Text$ that you're storing to the array is longer than
  7889.       Element.Size%, DOSMPUT will not store the data and it will pass a return
  7890.       code of 252 back to the calling program.  If the length of Text$ is
  7891.       less or equal to than Element.Size%, DOSMPUT will store all of the text.
  7892.  
  7893.       Text$ can be retrieved from the array by using the same technique with
  7894.       DOSMGET.  DOSMGET will always return a string of length Element.Size%.  If
  7895.       the length of the original string stored with DOSMPUT was less than Ele-
  7896.       ment.Size%, DOSMGET will still return a string of length Element.Size%.
  7897.       The back end of the string will be padded with nulls (CHR$(0)).
  7898.  
  7899.       If you transfer control from the program that allocates memory to another
  7900.       Quickbasic program, you may still be able to use the array allocated in
  7901.       the first program.  If the first program "CHAIN"'s to the second program,
  7902.       the array allocated in the first program will be intact - no data will be
  7903.       lost.  Additionally, the special linking requirements explained later in
  7904.       this Appendix apply only to the first program.  If, however, the first
  7905.       program "RUN"'s the second program, then the array allocated in the first
  7906.       program is lost.  If the second program needs to allocate memory, then it
  7907.       must be linked using the guidelines discussed later in this Appendix.
  7908.  
  7909.  
  7910.  
  7911.  
  7912.  
  7913.  
  7914.  
  7915.                        Copyright (c) 1987, AJM Software 
  7916.                                    -Page 119-
  7917.  
  7918.  
  7919.  
  7920.  
  7921.  
  7922.  
  7923.  
  7924.  
  7925.  
  7926.  
  7927.  
  7928.  
  7929.  
  7930.  
  7931.  
  7932.       Who can use the memory allocation services?
  7933.  
  7934.  
  7935.       Memory is a severely limited resource in most computers from large IBM
  7936.       mainframes to the PC.  Whether or not you can use the QBWARE/1 memory
  7937.       services depends on several factors.  We'll discuss each of these factors
  7938.       in detail to help you decide whether or not QBWARE/1 is viable for you.
  7939.  
  7940.       The first constraint is the amount physical conventional memory installed
  7941.       on your computer - this does not include extended or expanded memory.  The
  7942.       maximum amount of conventional memory that can be installed in any DOS
  7943.       computer is, of course, 640,000 bytes.  The rules to follow here are:
  7944.  
  7945.               - If you have less than 256K of memory, you probably cannot run
  7946.                 applications that use the QBWARE/1 memory services
  7947.  
  7948.               - If you have 256K of memory, you MIGHT be able to run these
  7949.                 applications, but you probably cannot write your own applica-
  7950.                 tions.  The Quickbasic integrated development requires to much
  7951.                 memory to allow testing.
  7952.  
  7953.               -If you have more than 256K of memory, you can probably run and
  7954.                test applications written with QBWARE/1 memory management facil-
  7955.                ities.  Read on for further information.
  7956.  
  7957.  
  7958.       The next constraint is the amount of memory used by things other than
  7959.       Quickbasic.  DOS requires a minimum of around 26K - and that is for a
  7960.       plain vanilla DOS.  I generally install several drivers and have my files
  7961.       and buffers parameters set pretty high so DOS requires 55K on my machine.
  7962.       If you have a great deal of TSR's (SideKick for example) installed, you
  7963.       may be giving up a lot of memory to them - the more memory used by TSR's,
  7964.       the less available to Quickbasic and QBWARE/1.  Both DOS and TSR's
  7965.       decrease the amount of memory available.  If you're having a problem using
  7966.       QBWARE/1 and you have TSR's installed, try removing them.
  7967.  
  7968.       The next constraint is the amount of memory used by Quickbasic.  The fig-
  7969.       ures presented here have been arrived at by analysis performed by us and
  7970.       in no way reflect any information received by Microsoft.  There are sev-
  7971.       eral factors that determine the amount of memory that a Quickbasic program
  7972.       needs to execute.  These are:
  7973.  
  7974.               - The amount of code that you write.  Quickbasic needs about 68K
  7975.                 of memory for the its' own routines.  Any code that you write
  7976.                 would be over and above this 68K.
  7977.  
  7978.  
  7979.  
  7980.  
  7981.                        Copyright (c) 1987, AJM Software 
  7982.                                    -Page 120-
  7983.  
  7984.  
  7985.  
  7986.  
  7987.  
  7988.  
  7989.  
  7990.  
  7991.  
  7992.  
  7993.  
  7994.  
  7995.  
  7996.  
  7997.  
  7998.  
  7999.               - The data area used by Quickbasic is always 64K - no more, no
  8000.                 less.
  8001.  
  8002.               - The size of the user library increases memory requirement by the
  8003.                 size of the code segments in the library.
  8004.  
  8005.               - Communication programs will require storage for buffers.  This,
  8006.                 of course, is allocated by the programmer.
  8007.  
  8008.               - All remaining memory gets allocated to the far heap.  If you use
  8009.                 large numeric arrays, they would be allocated here.  This is the
  8010.                 area of memory used by QBWARE/1.
  8011.  
  8012.       From this info, we can see that a very simple one-line Quickbasic program
  8013.       will need about 132K to run.  An approximation of memory requirements can
  8014.       be calculated with:
  8015.  
  8016.               Data segment size                 64K  +
  8017.               QB runtime library                68K  +
  8018.               Size of far arrays                ??   +           (1)
  8019.               User library code size            ??   +           (2)
  8020.               Size of EXE file                  ??   +           (3)
  8021.               Size of communication buffers     ??   +           (4)
  8022.  
  8023.               = memory requirements
  8024.  
  8025.       Add about 124K if you're running programs out of the QB editor. For
  8026.       programs compiled with the /o option, do not include the QB runtime
  8027.       library size.
  8028.  
  8029.       (1)  Far arrays are large numeric arrays defined in your program.  You can
  8030.            determine size using the following:
  8031.  
  8032.               Integer arrays - Size = Number of elements * 2
  8033.  
  8034.               Single precision - Size = Number of elements * 4
  8035.  
  8036.               Double precision - Size = Number of elements * 8
  8037.  
  8038.       (2) This is tough, but to be on the safe side, just use the size of your
  8039.           USERLIB.EXE file (or whatever your user library is named).
  8040.  
  8041.       (3) This is simply the size of the EXE file as reported by the DOS dir
  8042.           command.
  8043.  
  8044.       (4) This one is easy because you as the programmer allocate these with the
  8045.           /c:buffersize parameter.
  8046.  
  8047.                        Copyright (c) 1987, AJM Software 
  8048.                                    -Page 121-
  8049.  
  8050.  
  8051.  
  8052.  
  8053.  
  8054.  
  8055.  
  8056.  
  8057.  
  8058.  
  8059.  
  8060.  
  8061.  
  8062.  
  8063.  
  8064.  
  8065.       If, after adding these numbers together, we come up with a memory require-
  8066.       ment that is close to the size of memory installed in that computer, you
  8067.       probably cannot use the memory management facilities in QBWARE/1. If there
  8068.       is room in your program, read on (Remember, when you run a program from
  8069.       the Quickbasic editor, add about 124K).
  8070.  
  8071.  
  8072.  
  8073.  
  8074.       Preparing to use the memory allocation services
  8075.  
  8076.       When a Quickbasic program is linked, the linker tells DOS the minimum and
  8077.       maximum amounts of memory required by the program.  When you execute the
  8078.       program, DOS will attempt to allocate the maximum amount of memory needed
  8079.       by the program.  For Quickbasic programs, this maximum is always all of
  8080.       available memory.  Before using the memory allocation services, we must
  8081.       first adjust the amount of memory that DOS allocates for the program.
  8082.       This can be done in three ways:
  8083.  
  8084.          1) When linking your Quickbasic program, use the CP parameter to limit
  8085.             maximum memory size.  You can tell the assembler how much memory to
  8086.             allocate in units of 16 byte paragraphs.  For example, if we wanted
  8087.             a program to use 256k, we would link it like this:
  8088.  
  8089.                         qb testprog;
  8090.                         link testprog /cp:16000
  8091.  
  8092.            We can determine the number of paragraphs by taking the memory size
  8093.            and dividing by 16 (256,000 / 16 = 16000)
  8094.  
  8095.          2) For those of you who have Microsoft's MASM, you can use the EXEMOD
  8096.             utility.  EXEMOD will do the same thing that the CP parameter of
  8097.             link does except that we must specify the paragraph count in Hexa-
  8098.             decimal.  If we wanted a program to use 256k of memory, we could do
  8099.             this:
  8100.  
  8101.                         qb testprog;
  8102.                         link testprog;
  8103.                         exemod testprog /max 4000
  8104.  
  8105.              4000 is about the number of paragraphs, in hex, that we need to get
  8106.              256K - it's actually a little high, but it's easier to remember
  8107.              than 3E80.
  8108.  
  8109.          3)  The program QBTMOD.BAS, provided with QBWARE/1, will change the
  8110.              maximum memory requirement to 256K.  Source code is provided so you
  8111.              can modify it as you wish.
  8112.  
  8113.                        Copyright (c) 1987, AJM Software 
  8114.                                    -Page 122-
  8115.  
  8116.  
  8117.  
  8118.  
  8119.  
  8120.  
  8121.  
  8122.  
  8123.  
  8124.  
  8125.  
  8126.       Using the memory allocation services in the Quickbasic editor is a
  8127.       little trickier.  We must take the following steps in order to do this.
  8128.  
  8129.          1) Make a BACKUP of QB.EXE
  8130.  
  8131.          2) Make another BACKUP of QB.EXE
  8132.  
  8133.          3) Do one of the following:
  8134.  
  8135.                - EXEMOD QB /MAX 4000 (if you have EXEMOD)
  8136.  
  8137.                - QBTMOD QB /MAX 16000
  8138.  
  8139.       This will allow you to execute DOSMALLC once while in the Quickbasic edi-
  8140.       tor.  When you start Quickbasic, it will not allocate all of memory, how-
  8141.       ever, if you run a program (Ctrl-R) or SHELL from the editor, when you
  8142.       return to Quickbasic, it acquires all available memory.  This means that
  8143.       you can only run DOSMALLC once while in the editor.  If you need to run it
  8144.       again, you must first exit Quickbasic, and then start it again.
  8145.  
  8146.       This does cause some problems in debugging our programs, but if you need
  8147.       the additional string space and you don't have expanded memory, then your
  8148.       options are limited.
  8149.  
  8150.  
  8151.  
  8152.  
  8153.  
  8154.  
  8155.  
  8156.  
  8157.  
  8158.  
  8159.  
  8160.  
  8161.  
  8162.  
  8163.  
  8164.  
  8165.  
  8166.  
  8167.  
  8168.  
  8169.  
  8170.  
  8171.  
  8172.  
  8173.  
  8174.  
  8175.  
  8176.  
  8177.  
  8178.  
  8179.                        Copyright (c) 1987, AJM Software 
  8180.                                    -Page 123-
  8181.  
  8182.  
  8183.  
  8184.  
  8185.